From f1971c489a5d6674802fe60fb87a059b4a54afd7 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Fri, 3 May 2019 15:17:06 +0800 Subject: [PATCH] Fix riscv32 testing --- kernel/Makefile | 2 +- kernel/src/shell.rs | 2 +- tests/.gitignore | 1 + tests/hello_rust.out | 6 +++--- tests/test.sh | 4 +++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 5de068e..d8bb97a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -273,7 +273,7 @@ justrunui: build -device virtio-mouse-device justruntest: build - @qemu-system-$(arch) $(qemu_opts) --append $(init) -serial file:../tests/stdout -monitor null + @qemu-system-$(arch) $(filter-out -serial mon:stdio, $(qemu_opts)) --append $(init) -serial file:../tests/stdout -monitor null debug: $(kernel) $(kernel_img) @qemu-system-$(arch) $(qemu_opts) -s -S & diff --git a/kernel/src/shell.rs b/kernel/src/shell.rs index c26b176..7004ae9 100644 --- a/kernel/src/shell.rs +++ b/kernel/src/shell.rs @@ -45,9 +45,9 @@ pub fn add_user_shell() { let inode = ROOT_INODE.lookup(&cmdline).unwrap(); processor().manager().add(Thread::new_user( &inode, + &cmdline, cmdline.split(' ').map(|s| s.into()).collect(), Vec::new(), - Vec::new(), )); } diff --git a/tests/.gitignore b/tests/.gitignore index faa3a15..a87be06 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1 +1,2 @@ stdout +stdout.new diff --git a/tests/hello_rust.out b/tests/hello_rust.out index beaee7a..f821c52 100644 --- a/tests/hello_rust.out +++ b/tests/hello_rust.out @@ -1,3 +1,3 @@ -Hello Rust uCore! -I am process 0. -hello pass. +Hello Rust uCore! +I am process 0. +hello pass. diff --git a/tests/test.sh b/tests/test.sh index 1f1a8ca..5f65c85 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -13,7 +13,9 @@ do wait $pid - diff -I 'bbl loader' -I 'Hello RISCV! in hart' -u ${f%.cmd}.out stdout || { echo 'testing failed for' $f; exit 1; } + awk 'NR > 25 { print }' < stdout > stdout.new + + diff -u ${f%.cmd}.out stdout.new || { echo 'testing failed for' $f; exit 1; } echo testing $f pass done