[Skiboot] [PATCH 2/2] external/gard/tests: Add tests for the gard tool

Cyril Bur cyril.bur at au1.ibm.com
Mon Sep 7 17:24:10 AEST 2015


Simple tests for the gard tool that can be expanded on over time

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/gard/test/Makefile.check        |  27 +++++++++++++++++++++++++++
 external/gard/test/files/data1.bin       | Bin 0 -> 20480 bytes
 external/gard/test/results/00-list.err   |   0
 external/gard/test/results/00-list.out   |   5 +++++
 external/gard/test/results/01-show_1.err |   0
 external/gard/test/results/01-show_1.out |   9 +++++++++
 external/gard/test/results/02-usage.err  |  18 ++++++++++++++++++
 external/gard/test/results/02-usage.out  |   0
 external/gard/test/test-gard             |   5 +++++
 external/gard/test/test.sh               |   1 +
 external/gard/test/tests/00-list         |  10 ++++++++++
 external/gard/test/tests/01-show_1       |  10 ++++++++++
 external/gard/test/tests/02-usage        |  10 ++++++++++
 13 files changed, 95 insertions(+)
 create mode 100644 external/gard/test/Makefile.check
 create mode 100644 external/gard/test/files/data1.bin
 create mode 100644 external/gard/test/results/00-list.err
 create mode 100644 external/gard/test/results/00-list.out
 create mode 100644 external/gard/test/results/01-show_1.err
 create mode 100644 external/gard/test/results/01-show_1.out
 create mode 100644 external/gard/test/results/02-usage.err
 create mode 100644 external/gard/test/results/02-usage.out
 create mode 100755 external/gard/test/test-gard
 create mode 120000 external/gard/test/test.sh
 create mode 100644 external/gard/test/tests/00-list
 create mode 100644 external/gard/test/tests/01-show_1
 create mode 100644 external/gard/test/tests/02-usage

diff --git a/external/gard/test/Makefile.check b/external/gard/test/Makefile.check
new file mode 100644
index 0000000..0c1c702
--- /dev/null
+++ b/external/gard/test/Makefile.check
@@ -0,0 +1,27 @@
+# -*-Makefile-*-
+GARD_TEST := external/gard/test/test-gard
+
+link:
+	@ln -sf ../../test/test.sh external/gard/test/test.sh
+
+.PHONY: link
+
+check: $(GARD_TEST:%=%-check)
+
+coverage: $(GARD_TEST:%=%-gcov-run)
+
+$(GARD_TEST:%=%-check) : %-check: %
+	$(call Q, RUN-TEST ,$(VALGRIND) $<, $<)
+
+$(GARD_TEST): link external/gard/gard
+
+external/gard/gard: external/gard/gard.c
+	${MAKE} -C external/gard
+
+-include $(wildcard external/gard/test/*.d)
+
+clean: gard-test-clean
+
+gard-test-clean:
+	$(RM) external/gard/test/*.o
+	$(RM) external/gard/test/*-gcov
diff --git a/external/gard/test/files/data1.bin b/external/gard/test/files/data1.bin
new file mode 100644
index 0000000000000000000000000000000000000000..aa5bf1437e3ce8c74b7ea8a2b2b1dc9cbf989892
GIT binary patch
literal 20480
zcmeIy!41MN3<c2N3PykhxG)A|un{-JPz=BntYMN`>Jq#h?8wdO%dbh6%aZkxW43ec
zHfvSAlGE*5J$sL~&d1LjdUEeJYd=1J_Qzweo%zK at 2vs&=Y=IDj&_4s4U=wTt1r$&~
z0R<FLKmi35P(T3%6i`3`1r$&~0R<FLKmi35P(T3%6i`3`1r$&~0R<FLKmi35P(T3%
q6i`3`1r$&~0R<FLKmi35P(T3%6i~1$=qOYPNI(J-kbngKA%P#wS$qxv

literal 0
HcmV?d00001

diff --git a/external/gard/test/results/00-list.err b/external/gard/test/results/00-list.err
new file mode 100644
index 0000000..e69de29
diff --git a/external/gard/test/results/00-list.out b/external/gard/test/results/00-list.out
new file mode 100644
index 0000000..3fd3344
--- /dev/null
+++ b/external/gard/test/results/00-list.out
@@ -0,0 +1,5 @@
+|    ID    |   Error  | Type            |
++---------------------------------------+
+| 00000001 | 90000015 | physical        |
+| 00000002 | 90000016 | physical        |
++=======================================+
diff --git a/external/gard/test/results/01-show_1.err b/external/gard/test/results/01-show_1.err
new file mode 100644
index 0000000..e69de29
diff --git a/external/gard/test/results/01-show_1.out b/external/gard/test/results/01-show_1.out
new file mode 100644
index 0000000..4e5726b
--- /dev/null
+++ b/external/gard/test/results/01-show_1.out
@@ -0,0 +1,9 @@
+Record ID:    0x00000001
+========================
+Error ID:     0x90000015
+Error Type:         0xe6
+Res Recovery:       0xff
+Path Type: physical
+>System, Instance #0
+ >Node, Instance #0
+  >Processor, Instance #0
diff --git a/external/gard/test/results/02-usage.err b/external/gard/test/results/02-usage.err
new file mode 100644
index 0000000..ca0e4ec
--- /dev/null
+++ b/external/gard/test/results/02-usage.err
@@ -0,0 +1,18 @@
+Usage: external/gard/gard [-a -e -f <file> -p] <command> [<args>]
+
+-e --ecc
+	Force reading/writing with ECC bytes.
+
+-f --file <file>
+	Don't search for MTD device, read from <file>.
+
+-p --part
+	Used in conjunction with -f to specifythat just
+	the GUARD partition is in <file> and libffs
+	shouldn't be used.
+
+Where <command> is one of:
+
+	list   	List current GARD records
+	show   	Show details of a GARD record
+	clear  	Clear GARD records
diff --git a/external/gard/test/results/02-usage.out b/external/gard/test/results/02-usage.out
new file mode 100644
index 0000000..e69de29
diff --git a/external/gard/test/test-gard b/external/gard/test/test-gard
new file mode 100755
index 0000000..6b11e04
--- /dev/null
+++ b/external/gard/test/test-gard
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+. external/test/test.sh
+
+run_tests "external/gard/test/tests/*" "external/gard/test/results"
diff --git a/external/gard/test/test.sh b/external/gard/test/test.sh
new file mode 120000
index 0000000..386568f
--- /dev/null
+++ b/external/gard/test/test.sh
@@ -0,0 +1 @@
+../../test/test.sh
\ No newline at end of file
diff --git a/external/gard/test/tests/00-list b/external/gard/test/tests/00-list
new file mode 100644
index 0000000..18da746
--- /dev/null
+++ b/external/gard/test/tests/00-list
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "external/gard/gard" "-p -e -f external/gard/test/files/data1.bin list"
+if [ "$?" -ne 0 ] ; then
+	fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/external/gard/test/tests/01-show_1 b/external/gard/test/tests/01-show_1
new file mode 100644
index 0000000..8857dbb
--- /dev/null
+++ b/external/gard/test/tests/01-show_1
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "external/gard/gard" "-p -e -f external/gard/test/files/data1.bin show 1"
+if [ "$?" -ne 0 ] ; then
+	fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/external/gard/test/tests/02-usage b/external/gard/test/tests/02-usage
new file mode 100644
index 0000000..a2c9038
--- /dev/null
+++ b/external/gard/test/tests/02-usage
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "external/gard/gard"
+if [ "$?" -ne 1 ] ; then
+	fail_test
+fi
+
+diff_with_result
+
+pass_test
-- 
2.5.1



More information about the Skiboot mailing list