Fix cmpfiles() in runtests, add two tests in the new format
This commit is contained in:
parent
f5a5044e20
commit
1768109979
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,6 +23,7 @@ tools/randdir
|
||||
*.img
|
||||
*.raw
|
||||
*.out.???
|
||||
out.???
|
||||
*.out.indent
|
||||
.gdb_history
|
||||
umka.fas
|
||||
|
@ -34,8 +34,9 @@
|
||||
|
||||
thread_local char bufa[CMPFILE_BUF_LEN];
|
||||
thread_local char bufb[CMPFILE_BUF_LEN];
|
||||
thread_local char outfname[PATH_MAX];
|
||||
thread_local char timeoutfname[PATH_MAX];
|
||||
thread_local char reffname[PATH_MAX];
|
||||
thread_local char outfname[PATH_MAX];
|
||||
|
||||
int silent_success = 1;
|
||||
|
||||
@ -53,7 +54,8 @@ is_valid_test_name(const char *name) {
|
||||
}
|
||||
|
||||
static int
|
||||
cmpfile(const char *fnamea, const char *fnameb) {
|
||||
cmpfiles(const char *fnamea, const char *fnameb) {
|
||||
int result = 0;
|
||||
FILE *filea = fopen(fnamea, "rb");
|
||||
if (!filea) {
|
||||
fprintf(stderr, "Can't open file '%s' for reading: %s\n", fnamea,
|
||||
@ -64,25 +66,30 @@ cmpfile(const char *fnamea, const char *fnameb) {
|
||||
if (!fileb) {
|
||||
fprintf(stderr, "Can't open file '%s' for reading: %s\n", fnameb,
|
||||
strerror(errno));
|
||||
fclose(filea);
|
||||
return -1;
|
||||
}
|
||||
while (1) {
|
||||
size_t reada = fread(bufa, CMPFILE_BUF_LEN, 1, filea);
|
||||
size_t readb = fread(bufa, CMPFILE_BUF_LEN, 1, fileb);
|
||||
size_t reada = fread(bufa, 1, CMPFILE_BUF_LEN, filea);
|
||||
size_t readb = fread(bufb, 1, CMPFILE_BUF_LEN, fileb);
|
||||
if (reada != readb || memcmp(bufa, bufb, reada)) {
|
||||
fprintf(stderr, "[!] files %s and %s don't match\n", fnamea,
|
||||
fnameb);
|
||||
return -1;
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
if (feof(filea) && feof(fileb)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(filea);
|
||||
fclose(fileb);
|
||||
return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
check_test_artefacts(const char *testname) {
|
||||
DIR *tdir = opendir(".");
|
||||
DIR *tdir = opendir(testname);
|
||||
if (!tdir) {
|
||||
fprintf(stderr, "Can't open directory '%s': %s\n", testname,
|
||||
strerror(errno));
|
||||
@ -91,16 +98,16 @@ check_test_artefacts(const char *testname) {
|
||||
|
||||
struct dirent dent;
|
||||
struct dirent *result;
|
||||
const char *reffname;
|
||||
while (readdir_r(tdir, &dent, &result)) {
|
||||
reffname = dent.d_name;
|
||||
const char *dotrefdot = strstr(reffname, ".ref.");
|
||||
if (!dotrefdot) {
|
||||
while (!readdir_r(tdir, &dent, &result) && result) {
|
||||
const char *refdot = strstr(dent.d_name, "ref.");
|
||||
if (!refdot) {
|
||||
continue;
|
||||
}
|
||||
size_t ref_off = refdot - dent.d_name;
|
||||
sprintf(reffname, "%s/%s", testname, dent.d_name);
|
||||
strcpy(outfname, reffname);
|
||||
memcpy(outfname + (dotrefdot - reffname), ".out.", 5);
|
||||
if (cmpfile(reffname, outfname)) {
|
||||
memcpy(outfname + strlen(testname) + 1 + ref_off, "out", 3);
|
||||
if (cmpfiles(reffname, outfname)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
3536
test/t001/ref.log
Normal file
3536
test/t001/ref.log
Normal file
File diff suppressed because it is too large
Load Diff
37
test/t001/run.us
Normal file
37
test/t001/run.us
Normal file
@ -0,0 +1,37 @@
|
||||
umka_boot
|
||||
disk_add ../../img/xfs_v4_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 0
|
||||
disk_add ../../img/xfs_short_dir_i8.qcow2 hd1 -c 0
|
||||
|
||||
ls70 /hd0/1/sf_empty
|
||||
ls70 /hd0/1/sf
|
||||
#ls70 /hd0/1/sf -c 0
|
||||
ls70 /hd0/1/sf -f 1 -c 1
|
||||
ls70 /hd0/1/sf -f 2 -c 1
|
||||
ls70 /hd0/1/sf -f 3 -c 1
|
||||
ls70 /hd0/1/sf -f 3 -c 100
|
||||
ls70 /hd0/1/sf -f 200 -c 1
|
||||
|
||||
ls70 /hd1/1/sf
|
||||
ls70 /hd0/1/sf -f 1 -c 1
|
||||
ls70 /hd0/1/sf -f 2 -c 1
|
||||
ls70 /hd0/1/sf -f 3 -c 1
|
||||
ls70 /hd0/1/sf -f 3 -c 100
|
||||
ls70 /hd0/1/sf -f 200 -c 1
|
||||
ls70 /hd1/1/sf/d0000000002_xx
|
||||
|
||||
ls70 /hd0/1/block
|
||||
ls70 /hd0/1/block -f 5 -c 1
|
||||
ls70 /hd0/1/block -f 5 -c 1000
|
||||
ls70 /hd0/1/block -f 500 -c 1
|
||||
|
||||
ls70 /hd0/1/leaf
|
||||
ls70 /hd0/1/leaf -f 1 -c 1
|
||||
|
||||
ls70 /hd0/1/node
|
||||
ls70 /hd0/1/node -f 2 -c 2
|
||||
|
||||
ls70 /hd0/1/btree_leaf
|
||||
ls70 /hd0/1/btree_leaf -f 3 -c 3
|
||||
ls70 /hd0/1/btree_leaf_free
|
||||
|
||||
disk_del hd0
|
4
test/t001/tags.txt
Normal file
4
test/t001/tags.txt
Normal file
@ -0,0 +1,4 @@
|
||||
syscall: f70 f70s1
|
||||
fs: xfs
|
||||
xfs: ftype1
|
||||
blkdev: s05k
|
1
test/t001/timeout.txt
Normal file
1
test/t001/timeout.txt
Normal file
@ -0,0 +1 @@
|
||||
10s
|
3474
test/t002/ref.log
Normal file
3474
test/t002/ref.log
Normal file
File diff suppressed because it is too large
Load Diff
12
test/t002/run.us
Normal file
12
test/t002/run.us
Normal file
@ -0,0 +1,12 @@
|
||||
umka_boot
|
||||
disk_add ../../img/xfs_v4_ftype0_s05k_b2k_n8k.qcow2 hd0 -c 524288
|
||||
ls70 /hd0/1/sf_empty
|
||||
ls70 /hd0/1/sf
|
||||
ls70 /hd0/1/block
|
||||
ls70 /hd0/1/leaf
|
||||
ls70 /hd0/1/node
|
||||
ls70 /hd0/1/btree_leaf
|
||||
ls70 /hd0/1/btree_leaf_free
|
||||
ls70 /hd0/1/sf/.
|
||||
ls70 /hd0/1/sf/..
|
||||
disk_del hd0
|
4
test/t002/tags.txt
Normal file
4
test/t002/tags.txt
Normal file
@ -0,0 +1,4 @@
|
||||
syscall: f70 f70s1
|
||||
fs: xfs
|
||||
xfs: ftype0
|
||||
blkdev: s05k
|
1
test/t002/timeout.txt
Normal file
1
test/t002/timeout.txt
Normal file
@ -0,0 +1 @@
|
||||
10s
|
Loading…
Reference in New Issue
Block a user