aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-11 20:47:04 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-11 20:47:04 +0100
commit55e9614a6358fb3270405332e94c2eeda057350b (patch)
tree107d30ee39bef6933c51959b3333d80a0388c575
parent50b5427a8edbb8d59215334f5a250e7f8d6d7ca7 (diff)
downloadkogata-55e9614a6358fb3270405332e94c2eeda057350b.tar.gz
kogata-55e9614a6358fb3270405332e94c2eeda057350b.zip
Include kernel.map in tests.
-rw-r--r--res/fonts/Makefile5
-rw-r--r--res/keymaps/Makefile7
-rw-r--r--src/kernel/core/region.c3
-rwxr-xr-xsrc/tests/ktests/run_qemu_test.sh2
-rw-r--r--src/tests/utests/fs2/test.c8
-rw-r--r--src/tests/utests/rules.make2
-rwxr-xr-xsrc/tests/utests/run_qemu_test.sh2
-rw-r--r--src/tests/utests/subfs/test.c8
8 files changed, 25 insertions, 12 deletions
diff --git a/res/fonts/Makefile b/res/fonts/Makefile
index 8b50213..9a2a6b3 100644
--- a/res/fonts/Makefile
+++ b/res/fonts/Makefile
@@ -3,6 +3,8 @@ CFLAGS=-I../../src/lib/include -std=c11
AS=nasm
ASFLAGS=-fbin
+all: pcvga.bf muazzam.bf
+
%.bf: %.c
$(CC) $(CFLAGS) -o $<.bin $<
./$<.bin > $@
@@ -11,8 +13,7 @@ ASFLAGS=-fbin
%.bf: %.s
$(AS) $(ASFLAGS) -o $@ $<
-all: pcvga.bf muazzam.bf
-
clean:
rm *.bf || exit 0
+rebuild: clean all
diff --git a/res/keymaps/Makefile b/res/keymaps/Makefile
index 394685e..3e7a755 100644
--- a/res/keymaps/Makefile
+++ b/res/keymaps/Makefile
@@ -1,10 +1,15 @@
CC=gcc
CFLAGS=-I../../src/lib/include -std=c11
+all: fr.km
+
%.km: %.c
$(CC) $(CFLAGS) -o $<.bin $<
./$<.bin > $@
rm $<.bin
-all: fr.km
+clean:
+ rm *.km || exit 0
+
+rebuild: clean all
diff --git a/src/kernel/core/region.c b/src/kernel/core/region.c
index c4c34d1..886c9fc 100644
--- a/src/kernel/core/region.c
+++ b/src/kernel/core/region.c
@@ -165,9 +165,12 @@ descriptor_t *find_used_region(void* addr) {
void add_used_region(descriptor_t *d) {
descriptor_t *i = first_used_region;
+ ASSERT(i != 0);
ASSERT(i->used.i.addr < d->used.i.addr); // first region by address is never free
while (i != 0) {
+ ASSERT(i != d);
+ ASSERT(i->used.i.addr != d->used.i.addr);
ASSERT(i->used.i.addr < d->used.i.addr);
if (i->used.next_by_addr == 0 || i->used.next_by_addr->used.i.addr > d->used.i.addr) {
d->used.next_by_addr = i->used.next_by_addr;
diff --git a/src/tests/ktests/run_qemu_test.sh b/src/tests/ktests/run_qemu_test.sh
index e18a9d3..0e7b83e 100755
--- a/src/tests/ktests/run_qemu_test.sh
+++ b/src/tests/ktests/run_qemu_test.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-(qemu-system-i386 -kernel test_kernel.bin -serial stdio -m 16 -display none & echo $! >pid) \
+(qemu-system-i386 -kernel test_kernel.bin -initrd ../../kernel/kernel.map -serial stdio -m 16 -display none & echo $! >pid) \
| tee >(grep -m 1 "TEST-" >result; kill -INT `cat pid`) \
RESULT=`cat result`
diff --git a/src/tests/utests/fs2/test.c b/src/tests/utests/fs2/test.c
index f993c8e..7cc5fb6 100644
--- a/src/tests/utests/fs2/test.c
+++ b/src/tests/utests/fs2/test.c
@@ -14,10 +14,12 @@ int main(int argc, char **argv) {
dirent_t x;
size_t ent_no = 0;
- ASSERT (readdir(f, ent_no++, &x));
+ while (ent_no < 2) {
+ ASSERT (readdir(f, ent_no++, &x));
- ASSERT(!strcmp(x.name, "init.bin"));
- ASSERT(x.st.type == FT_REGULAR);
+ ASSERT((!strcmp(x.name, "init.bin")) || (!strcmp(x.name, "kernel.map")));
+ ASSERT(x.st.type == FT_REGULAR);
+ }
ASSERT(!readdir(f, ent_no++, &x));
close(f);
diff --git a/src/tests/utests/rules.make b/src/tests/utests/rules.make
index 3e5fe1c..ec48e87 100644
--- a/src/tests/utests/rules.make
+++ b/src/tests/utests/rules.make
@@ -1,4 +1,4 @@
-LIB = ../../../lib/libkogata/libkogata.lib ../../../common/libc/libc.lib
+LIB = ../../../lib/libkogata/libkogata.lib
OBJ = test.o
diff --git a/src/tests/utests/run_qemu_test.sh b/src/tests/utests/run_qemu_test.sh
index 2de4bbb..c168e8c 100755
--- a/src/tests/utests/run_qemu_test.sh
+++ b/src/tests/utests/run_qemu_test.sh
@@ -9,7 +9,7 @@ if [ "$1" = "watchdog" ]; then
exit 0
fi
-(qemu-system-i386 -kernel ../../../kernel/kernel.bin -append 'init=io:/mod/init.bin' -initrd init.bin -serial stdio -m 16 -display none & echo $! >pid &
+(qemu-system-i386 -kernel ../../../kernel/kernel.bin -append 'init=io:/mod/init.bin' -initrd 'init.bin,../../../kernel/kernel.map' -serial stdio -m 16 -display none & echo $! >pid &
$0 watchdog) \
| tee >(grep -m 1 "TEST-" >result; kill -INT `cat pid`; kill -TERM `cat pid2`) \
diff --git a/src/tests/utests/subfs/test.c b/src/tests/utests/subfs/test.c
index 2612939..5233ffe 100644
--- a/src/tests/utests/subfs/test.c
+++ b/src/tests/utests/subfs/test.c
@@ -16,10 +16,12 @@ int main(int argc, char **argv) {
dirent_t x;
size_t ent_no = 0;
- ASSERT (readdir(f, ent_no++, &x));
+ while (ent_no < 2) {
+ ASSERT (readdir(f, ent_no++, &x));
- ASSERT(!strcmp(x.name, "init.bin"));
- ASSERT(x.st.type == FT_REGULAR);
+ ASSERT((!strcmp(x.name, "init.bin")) || (!strcmp(x.name, "kernel.map")));
+ ASSERT(x.st.type == FT_REGULAR);
+ }
ASSERT(!readdir(f, ent_no++, &x));
close(f);