Coverage and testing harness improvements.
Use -c key for umka_shell to trace branches, no recompilation needed. Create >4GiB file for tests. Create empty kolibri.img and put built default.skn there.
This commit is contained in:
parent
fcba0e2fa3
commit
f39db79da3
33
img/makefile
33
img/makefile
@ -3,7 +3,7 @@ MKFILEPATTERN=../tools/mkfilepattern
|
||||
MOUNT_OPT=-t xfs
|
||||
TEMP_DIR:=$(shell mktemp -d)
|
||||
|
||||
all: s05k s4k unicode v5
|
||||
all: s05k s4k unicode v5 kolibri.img
|
||||
rmdir $(TEMP_DIR)
|
||||
|
||||
s05k: xfs_v4_ftype0_s05k_b2k_n8k.img xfs_v4_ftype1_s05k_b2k_n8k.img xfs_v4_xattr.img xfs_v4_files_s05k_b4k_n8k.img xfs_v4_ftype0_s05k_b2k_n8k_xattr.img
|
||||
@ -14,6 +14,12 @@ unicode: xfs_v4_unicode.img
|
||||
|
||||
v5: xfs_v5_ftype1_s05k_b2k_n8k.img xfs_v5_files_s05k_b4k_n8k.img
|
||||
|
||||
kolibri.img: ../default.skn
|
||||
touch $@
|
||||
fallocate -z -o 0 -l 1440KiB $@
|
||||
mkfs.vfat -n KOLIBRIOS -F 12 $@
|
||||
mcopy -vmoi $@ $< ::DEFAULT.SKN
|
||||
|
||||
xfs_v4_ftype0_s05k_b2k_n8k.img:
|
||||
fallocate -l 63MiB $@
|
||||
sudo mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=0 $@
|
||||
@ -120,15 +126,15 @@ xfs_v4_files_s05k_b4k_n8k.img:
|
||||
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
|
||||
sudo chown $$USER $(TEMP_DIR) -R
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 0 65536
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_begin 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_begin 0 65536
|
||||
fallocate -p -o 0 -l 16KiB $(TEMP_DIR)/hole_begin
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_middle 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_middle 0 65536
|
||||
fallocate -p -o 32KiB -l 16KiB $(TEMP_DIR)/hole_middle
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_end 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_end 0 65536
|
||||
fallocate -p -o 48KiB -l 16KiB $(TEMP_DIR)/hole_end
|
||||
#
|
||||
fallocate -l 4KiB $(TEMP_DIR)/btree_l1_no_hole
|
||||
@ -136,7 +142,12 @@ xfs_v4_files_s05k_b4k_n8k.img:
|
||||
fallocate -i -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
|
||||
fallocate -z -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
|
||||
done
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 8196096
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 0 8196096
|
||||
#
|
||||
# fallocate -l 5GiB $(TEMP_DIR)/4GiB_plus
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/4GiB_plus 0x120008000 0x1000
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/4GiB_plus 0x120000000 0x4000
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/4GiB_plus 0xffffe000 0x4000
|
||||
#
|
||||
sudo umount $(TEMP_DIR)
|
||||
fallocate -i -o 0 -l 1MiB $@
|
||||
@ -274,15 +285,15 @@ xfs_v5_files_s05k_b4k_n8k.img:
|
||||
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
|
||||
sudo chown $$USER $(TEMP_DIR) -R
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/no_hole 0 65536
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_begin 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_begin 0 65536
|
||||
fallocate -p -o 0 -l 16KiB $(TEMP_DIR)/hole_begin
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_middle 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_middle 0 65536
|
||||
fallocate -p -o 32KiB -l 16KiB $(TEMP_DIR)/hole_middle
|
||||
#
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_end 65536
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/hole_end 0 65536
|
||||
fallocate -p -o 48KiB -l 16KiB $(TEMP_DIR)/hole_end
|
||||
#
|
||||
fallocate -l 4KiB $(TEMP_DIR)/btree_l1_no_hole
|
||||
@ -290,7 +301,7 @@ xfs_v5_files_s05k_b4k_n8k.img:
|
||||
fallocate -i -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
|
||||
fallocate -z -l 4KiB -o 0KiB $(TEMP_DIR)/btree_l1_no_hole ; \
|
||||
done
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 8196096
|
||||
$(MKFILEPATTERN) $(TEMP_DIR)/btree_l1_no_hole 0 8196096
|
||||
#
|
||||
sudo umount $(TEMP_DIR)
|
||||
fallocate -i -o 0 -l 1MiB $@
|
||||
|
7
makefile
7
makefile
@ -6,7 +6,7 @@ CFLAGS_32=$(CFLAGS) -m32
|
||||
LDFLAGS=
|
||||
LDFLAGS_32=$(LDFLAGS) -m32
|
||||
|
||||
all: umka_shell umka_fuse umka.sym umka.prp umka.lst tags tools/mkdirrange tools/mkfilepattern covpreproc
|
||||
all: umka_shell umka_fuse umka.sym umka.prp umka.lst tags tools/mkdirrange tools/mkfilepattern covpreproc default.skn skin.skn
|
||||
|
||||
covpreproc: covpreproc.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
@ -17,12 +17,15 @@ umka_shell: umka_shell.o umka.o trace.o trace_lbr.o vdisk.o lodepng.o
|
||||
umka_fuse: umka_fuse.o umka.o vdisk.o
|
||||
$(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs`
|
||||
|
||||
umka.o umka.fas: umka.asm skin.skn
|
||||
umka.o umka.fas: umka.asm
|
||||
INCLUDE="$(KOLIBRI)/kernel/trunk;$(KOLIBRI)/programs/develop/libraries/libcrash/trunk" $(FASM) $< umka.o -s umka.fas -m 1234567
|
||||
|
||||
lodepng.o: lodepng.c lodepng.h
|
||||
$(CC) $(CFLAGS_32) -c $<
|
||||
|
||||
default.skn: $(KOLIBRI)/skins/Leency/Shkvorka/default.asm
|
||||
$(FASM) $< $@
|
||||
|
||||
skin.skn: $(KOLIBRI)/skins/Leency/Octo_flat/default.asm
|
||||
$(FASM) $< $@
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
ifneq ($(COVERAGE),)
|
||||
TASKSET=taskset 1
|
||||
ifndef COVERAGE
|
||||
UMKA_SHELL=../umka_shell
|
||||
else
|
||||
UMKA_SHELL=sudo taskset 1 ../umka_shell -c
|
||||
endif
|
||||
|
||||
UMKA_SHELL=$(TASKSET) ../umka_shell
|
||||
|
||||
xfs_tests := $(addsuffix .out.log, $(basename $(wildcard *\#xfs_*.t)))
|
||||
s05k_tests := $(addsuffix .out.log, $(basename $(wildcard *\#s05k_*.t)))
|
||||
s4k_tests := $(addsuffix .out.log, $(basename $(wildcard *\#s4k_*.t)))
|
||||
|
@ -16,13 +16,15 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
uint8_t buf[BUF_LEN + 7];
|
||||
int64_t len;
|
||||
off_t offset;
|
||||
char *path;
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "mkfilepattern filename size\n");
|
||||
if (argc != 4) {
|
||||
fprintf(stderr, "mkfilepattern filename offset length\n");
|
||||
exit(1);
|
||||
} else {
|
||||
path = argv[1];
|
||||
sscanf(argv[2], "%" SCNi64, &len);
|
||||
offset = strtoll(argv[2], NULL, 0);
|
||||
len = strtoll(argv[3], NULL, 0);
|
||||
}
|
||||
|
||||
int fd = open(path, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
@ -31,9 +33,10 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (int64_t pos = 0, count = BUF_LEN; pos < len; pos += count) {
|
||||
if (count > len - pos) {
|
||||
count = len - pos;
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
for (int64_t pos = offset, count = BUF_LEN; pos < offset + len; pos += count) {
|
||||
if (count > offset + len - pos) {
|
||||
count = offset + len - pos;
|
||||
}
|
||||
|
||||
off_t off = 0;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@ -75,7 +74,6 @@ void set_eflags_tf(uint32_t tf) {
|
||||
}
|
||||
|
||||
void trace_lbr_begin() {
|
||||
printf("hello from lbr!\n");
|
||||
struct sigaction action;
|
||||
action.sa_sigaction = &handle_sigtrap;
|
||||
action.sa_flags = SA_SIGINFO;
|
||||
|
46
umka_shell.c
46
umka_shell.c
@ -46,14 +46,6 @@
|
||||
#define DEFAULT_READDIR_ENCODING UTF8
|
||||
#define DEFAULT_PATH_ENCODING UTF8
|
||||
|
||||
#define CHECK_OPTION_ARG \
|
||||
do { \
|
||||
if (!argv[++optind]) { \
|
||||
puts(usage); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
diskfunc_t vdisk_functions = {
|
||||
.strucsize = sizeof(diskfunc_t),
|
||||
.close = vdisk_close,
|
||||
@ -977,10 +969,6 @@ func_table_t funcs[] = {
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
void usage() {
|
||||
printf("usage: umka_shell [test_file.t]\n");
|
||||
}
|
||||
|
||||
void *run_test(const char *infile_name) {
|
||||
FILE *infile, *outfile;
|
||||
|
||||
@ -993,7 +981,6 @@ void *run_test(const char *infile_name) {
|
||||
char *last_dot = strrchr(outfile_name, '.');
|
||||
if (!last_dot) {
|
||||
printf("test file must have '.t' suffix\n");
|
||||
usage();
|
||||
return NULL;
|
||||
}
|
||||
strcpy(last_dot, ".out.log");
|
||||
@ -1037,21 +1024,32 @@ void *run_test(const char *infile_name) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *usage = \
|
||||
"usage: umka_shell [test_file.t] [-c]\n"
|
||||
" -c trace branches to collect coverage";
|
||||
const char *test_file = NULL;
|
||||
|
||||
int opt;
|
||||
optind = 1;
|
||||
if (argc > 1 && *argv[optind] != '-') {
|
||||
test_file = argv[optind++];
|
||||
}
|
||||
while ((opt = getopt(argc, argv, "c")) != -1) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
trace = 1;
|
||||
break;
|
||||
default:
|
||||
puts(usage);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (trace)
|
||||
trace_begin();
|
||||
kos_init();
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
run_test(NULL);
|
||||
break;
|
||||
case 2: {
|
||||
run_test(argv[1]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
run_test(test_file);
|
||||
|
||||
if (trace)
|
||||
trace_end();
|
||||
|
Loading…
Reference in New Issue
Block a user