aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-05-25 18:47:54 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-25 18:49:14 +1000
commit8d18e38a7c61e01b9b6ad5a70bf48697b70aa0ec (patch)
tree3b202f6c53627e4671601cbba5dcf545950934ff
parent35c65cf4e97c76fae58ba3f997f9667c10c3871d (diff)
downloadskiboot-8d18e38a7c61e01b9b6ad5a70bf48697b70aa0ec.zip
skiboot-8d18e38a7c61e01b9b6ad5a70bf48697b70aa0ec.tar.gz
skiboot-8d18e38a7c61e01b9b6ad5a70bf48697b70aa0ec.tar.bz2
Add boot-coverage-report target
This target will run the (two) current boot tests and produce lcov coverage of skiboot from running them in Mambo. Everything is pretty hard coded at this stage and should most certainly be improved upon, especially if we want input from real hardware or to have more boot tests. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--test/Makefile.check5
-rw-r--r--test/hello_world/Makefile.check2
-rw-r--r--test/hello_world/run_hello_world.tcl3
-rwxr-xr-xtest/make-boot-coverage-report.sh19
-rw-r--r--test/run_boot_test.tcl4
5 files changed, 30 insertions, 3 deletions
diff --git a/test/Makefile.check b/test/Makefile.check
index 6402f95..ffe4cb7 100644
--- a/test/Makefile.check
+++ b/test/Makefile.check
@@ -2,3 +2,8 @@ check: boot-check
boot-check: skiboot.lid
./test/run_boot_test.sh
+
+boot-tests: boot-check
+
+boot-coverage-report: boot-tests extract-gcov skiboot.map
+ CROSS=$(CROSS) ./test/make-boot-coverage-report.sh
diff --git a/test/hello_world/Makefile.check b/test/hello_world/Makefile.check
index cfb64d9..638a627 100644
--- a/test/hello_world/Makefile.check
+++ b/test/hello_world/Makefile.check
@@ -2,6 +2,8 @@ HELLO_WORLD_TEST := test/hello_world/hello_kernel/hello_kernel
check: $(HELLO_WORLD_TEST:%=%-check)
+boot-tests: $(HELLO_WORLD_TEST:%=%-check)
+
$(HELLO_WORLD_TEST:%=%-check) : %-check: % skiboot.lid
./test/hello_world/run_hello_world.sh
diff --git a/test/hello_world/run_hello_world.tcl b/test/hello_world/run_hello_world.tcl
index e44fe16..0e2922d 100644
--- a/test/hello_world/run_hello_world.tcl
+++ b/test/hello_world/run_hello_world.tcl
@@ -1,4 +1,5 @@
source ../../external/mambo/skiboot.tcl
mysim go
-exit \ No newline at end of file
+mysim memory fwrite 0x30000000 0x300000 skiboot-hello_world.dump
+exit
diff --git a/test/make-boot-coverage-report.sh b/test/make-boot-coverage-report.sh
new file mode 100755
index 0000000..5d36345
--- /dev/null
+++ b/test/make-boot-coverage-report.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# We cheat and do this in a shell script so I don't go Makefile crazy.
+
+SKIBOOT_GCOV_ADDR=`perl -e "printf '0x%x', 0x30000000 + 0x\`grep gcov_info_list skiboot.map|cut -f 1 -d ' '\`"`
+
+find .|grep '\.gcda$'|xargs rm -f
+
+./extract-gcov ./external/mambo/skiboot-hello_world.dump $SKIBOOT_GCOV_ADDR
+lcov -q -b . -d . -c -o skiboot-hello_world.info --gcov-tool ${CROSS}gcov
+find .|grep '\.gcda$'|xargs rm -f
+
+./extract-gcov ./external/mambo/skiboot-boot_test.dump $SKIBOOT_GCOV_ADDR
+lcov -q -b . -d . -c -o skiboot-boot_test.info --gcov-tool ${CROSS}gcov
+find .|grep '\.gcda$'|xargs rm -f
+
+lcov -q -b . -d . --gcov-tool ${CROSS}gcov -o skiboot-boot.info -a skiboot-boot_test.info -a skiboot-hello_world.info
+
+genhtml -o boot-coverage-report skiboot-boot.info \ No newline at end of file
diff --git a/test/run_boot_test.tcl b/test/run_boot_test.tcl
index 81f2852..0f7fa84 100644
--- a/test/run_boot_test.tcl
+++ b/test/run_boot_test.tcl
@@ -11,6 +11,6 @@ proc console_trigger {response args} {
mysim trigger set console "Welcome to Petitboot" { console_trigger "x" }
mysim trigger set console "# " { console_trigger "halt\n" }
-
mysim go
-exit \ No newline at end of file
+mysim memory fwrite 0x30000000 0x300000 skiboot-boot_test.dump
+exit