Make an order in test/ directory, write proper makefile.

This commit is contained in:
Ivan Baravy 2019-10-22 05:24:44 +03:00
parent c4a635322a
commit 68454dbe4d
18 changed files with 33 additions and 24 deletions

2
.gitignore vendored
View File

@ -17,3 +17,5 @@ kolibri.fas
kolibri.sym kolibri.sym
kolibri.lst kolibri.lst
kolibri.prp kolibri.prp
tags
*.out

2
cio.c
View File

@ -20,7 +20,7 @@ void *cio_disk_init(const char *fname) {
sect_size = 4096; sect_size = 4096;
} }
vdisk_t *vdisk = (vdisk_t*)malloc(sizeof(vdisk_t)); vdisk_t *vdisk = (vdisk_t*)malloc(sizeof(vdisk_t));
*vdisk = (vdisk_t){f, fsize / sect_size, sect_size}; *vdisk = (vdisk_t){f, (uint64_t)fsize / sect_size, sect_size};
return vdisk; return vdisk;
} }

View File

@ -6,7 +6,6 @@ TEMP_DIR:=$(shell mktemp -d)
all: s512_xfs_v4_ftype0.img s512_xfs_v4_ftype0_b4k_n2b.img s512_xfs_v4_ftype1.img s512_xfs_v4_ftype0_xattr.img s512_xfs_v4_files.img s512_xfs_v4_files_b4k_n2b.img s512_xfs_v4_ftype1_btree_dirs.img all: s512_xfs_v4_ftype0.img s512_xfs_v4_ftype0_b4k_n2b.img s512_xfs_v4_ftype1.img s512_xfs_v4_ftype0_xattr.img s512_xfs_v4_files.img s512_xfs_v4_files_b4k_n2b.img s512_xfs_v4_ftype1_btree_dirs.img
s512_xfs_v4_ftype0.img: s512_xfs_v4_ftype0.img:
# dd if=/dev/zero of=$@ bs=1M count=64
fallocate -l 64MiB $@ fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -34,7 +33,6 @@ s512_xfs_v4_ftype0.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_ftype0_b4k_n2b.img: s512_xfs_v4_ftype0_b4k_n2b.img:
# dd if=/dev/zero of=$@ bs=1M count=64
fallocate -l 64MiB $@ fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -62,7 +60,6 @@ s512_xfs_v4_ftype0_b4k_n2b.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_ftype1.img: s512_xfs_v4_ftype1.img:
# dd if=/dev/zero of=$@ bs=1M count=64
fallocate -l 64MiB $@ fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -90,7 +87,6 @@ s512_xfs_v4_ftype1.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_ftype0_xattr.img: s512_xfs_v4_ftype0_xattr.img:
# dd if=/dev/zero of=$@ bs=1M count=64
fallocate -l 64MiB $@ fallocate -l 64MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -115,7 +111,6 @@ s512_xfs_v4_ftype0_xattr.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_ftype1_btree_dirs.img: s512_xfs_v4_ftype1_btree_dirs.img:
# dd if=/dev/zero of=$@ bs=1M count=128
fallocate -l 128MiB $@ fallocate -l 128MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -131,7 +126,6 @@ s512_xfs_v4_ftype1_btree_dirs.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_files.img: s512_xfs_v4_files.img:
# dd if=/dev/zero of=$@ bs=1M count=128000
fallocate -l 128MiB $@ fallocate -l 128MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%
@ -166,7 +160,6 @@ s512_xfs_v4_files.img:
sudo losetup -d $(LOOP_DEV) sudo losetup -d $(LOOP_DEV)
s512_xfs_v4_files_b4k_n2b.img: s512_xfs_v4_files_b4k_n2b.img:
# dd if=/dev/zero of=$@ bs=1M count=128000
fallocate -l 128MiB $@ fallocate -l 128MiB $@
parted --script $@ mktable gpt parted --script $@ mktable gpt
parted --script --align optimal $@ mkpart primary 1MiB 100% parted --script --align optimal $@ mkpart primary 1MiB 100%

2
kofu.c
View File

@ -34,7 +34,7 @@ bool parse_uintmax(const char *str, uintmax_t *res) {
bool parse_uint32(const char *str, uint32_t *res) { bool parse_uint32(const char *str, uint32_t *res) {
uintmax_t x; uintmax_t x;
if (parse_uintmax(str, &x) && x <= UINT32_MAX) { if (parse_uintmax(str, &x) && x <= UINT32_MAX) {
*res = x; *res = (uint32_t)x;
return true; return true;
} else { } else {
perror("invalid number"); perror("invalid number");

View File

@ -1,6 +1,7 @@
FASM=fasm FASM=fasm
CC=gcc CC=gcc
CFLAGS=-Wall -Wextra -g -O0 -D_FILE_OFFSET_BITS=64 -Wno-address-of-packed-member WARNINGS=-Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -Wnull-dereference -Wjump-misses-init -Wshadow -Wformat=2 -Wswitch -Wswitch-enum #-Wconversion -Wsign-conversion
CFLAGS=$(WARNINGS) -g -O0 -D_FILE_OFFSET_BITS=64 -Wno-address-of-packed-member
CFLAGS_32=-m32 CFLAGS_32=-m32
LDFLAGS= LDFLAGS=
LDFLAGS_32=-m32 LDFLAGS_32=-m32
@ -49,5 +50,5 @@ tools/mkfilepattern: tools/mkfilepattern.c
.PHONY: all clean .PHONY: all clean
clean: clean:
rm -f *.o kofu kofuse kolibri.fas kolibri.sym kolibri.lst coverage tools/mkdirrange tools/mkfilepattern rm -f *.o kofu kofuse kolibri.fas kolibri.sym kolibri.lst kolibri.prp coverage tools/mkdirrange tools/mkfilepattern

View File

@ -0,0 +1,4 @@
#0> disk_add ../img/s512_xfs_v4_files.img hd0
/hd0/1: xfs
#1> read /hd0/1/no_hole 0 2 -b
0001

View File

@ -0,0 +1,2 @@
disk_add ../img/s512_xfs_v4_files.img hd0
read /hd0/1/no_hole 0 2 -b

5
test/004_705_stat.ref Normal file
View File

@ -0,0 +1,5 @@
#0> disk_add ../img/s512_xfs_v4_files.img hd0
/hd0/1: xfs
#1> stat /hd0/1/no_hole
attr: 0x00
size: 65536

2
test/004_705_stat.t Normal file
View File

@ -0,0 +1,2 @@
disk_add ../img/s512_xfs_v4_files.img hd0
stat /hd0/1/no_hole

View File

@ -1,16 +1,18 @@
KOFU=../kofu KOFU=../kofu
all: t_000_ls_all_dir_types_ftype0 t_001_ls_all_dir_types_ftype1 t_002_ls_all_dir_types_ftype0_b4k_n2b sf700_tests := $(addsuffix .out, $(basename $(wildcard *_700_*.t)))
.PHONY: t_000_ls_all_dir_types_ftype0 t_001_ls_all_dir_types_ftype1 t_002_ls_all_dir_types_ftype0_b4k_n2b sf701_tests := $(addsuffix .out, $(basename $(wildcard *_701_*.t)))
sf705_tests := $(addsuffix .out, $(basename $(wildcard *_705_*.t)))
t_000_ls_all_dir_types_ftype0: all: f70
$(KOFU) ../img/s512_xfs_v4_ftype0.img < $@ > $@.out @echo all test passed
cmp $@.ref $@.out
t_001_ls_all_dir_types_ftype1: f70: sf700 sf701 sf705
$(KOFU) ../img/s512_xfs_v4_ftype1.img < $@ > $@.out sf700: $(sf700_tests)
cmp $@.ref $@.out sf701: $(sf701_tests)
sf705: $(sf705_tests)
%.out: %.ref %.t
$(KOFU) < $(word 2, $^) > $@
cmp $@ $<
t_002_ls_all_dir_types_ftype0_b4k_n2b:
$(KOFU) ../img/s512_xfs_v4_ftype0_b4k_n2b.img < $@ > $@.out
cmp $@.ref $@.out

View File

@ -1 +0,0 @@
read /hd0/1/123/two 2 2

View File

@ -1 +0,0 @@
stat /hd0/1/123/two