Skip to content

Commit 550e294

Browse files
committed
test run on CI
1 parent af9207d commit 550e294

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

.github/workflows/build.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,19 @@ jobs:
3535
with:
3636
name: lemon.aarch64
3737
path: "lemon.aarch64"
38-
continue-on-error: true
38+
continue-on-error: true
39+
run:
40+
needs: build
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
os: [ubuntu-24.04-arm, ubuntu-24.04]
45+
steps:
46+
- name: Download artifacts
47+
uses: actions/download-artifact@v4
48+
- name: Run dump to disk
49+
run: |
50+
pwd
51+
ls -l
52+
sudo ./lemon.$(uname -m) -d /dev/null
53+
# TODO build and run on NO CORE

disk.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ static int write_on_disk(void *restrict args, const void *restrict data, const u
4242
* generic dump function. Ensures data is flushed and file descriptor is closed.
4343
*/
4444
int dump_on_disk(const struct options *restrict opts, const struct ram_regions *restrict ram_regions) {
45-
4645
int fd;
4746
int ret = 0;
4847

@@ -59,11 +58,24 @@ int dump_on_disk(const struct options *restrict opts, const struct ram_regions *
5958
}
6059

6160
/* Dump! */
62-
ret = dump(opts, ram_regions, write_on_disk, (void *)&fd);
61+
ret = dump(opts, ram_regions, write_on_disk, (void *)&fd); // TODO this ret is not checked
6362

64-
if(fd) {
65-
if(fsync(fd)) { perror("Fail to finalize writes on dump file"); ret = errno; }
66-
if(close(fd)) { perror("Fail to close dump file"); ret = errno; }
63+
if(fsync(fd)) {
64+
switch (errno) {
65+
case EINVAL:
66+
/* fd is bound to a special file (e.g., a pipe, FIFO, or
67+
* socket) which does not support synchronization.
68+
*/
69+
break;
70+
default:
71+
perror("Failed to finalize writes on dump file");
72+
ret = errno;
73+
}
74+
}
75+
76+
if(close(fd)) {
77+
perror("Failed to close the dump file");
78+
ret = errno;
6779
}
6880

6981
return ret;

lemon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
124124
struct ram_regions ram_regions;
125125
struct options opts = {0};
126126
struct argp argp = {options, parse_opt, "", doc};
127-
int ret;
127+
int ret = EXIT_SUCCESS;
128128

129129
/* Check if is running as root */
130130
if(getuid() != 0) {
@@ -197,5 +197,5 @@ int main(int argc, char **argv)
197197
/* Restore kptr_restrict if needed */
198198
if((ret = toggle_kptr())) return ret;
199199

200-
return EXIT_SUCCESS;
200+
return ret;
201201
}

0 commit comments

Comments
 (0)