aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/external/gard/test
diff options
context:
space:
mode:
Diffstat (limited to 'roms/skiboot/external/gard/test')
-rwxr-xr-xroms/skiboot/external/gard/test/add_test.sh67
-rw-r--r--roms/skiboot/external/gard/test/files/blank.binbin0 -> 20480 bytes
-rw-r--r--roms/skiboot/external/gard/test/files/data-p9.binbin0 -> 20480 bytes
-rw-r--r--roms/skiboot/external/gard/test/files/data1.binbin0 -> 20480 bytes
-rwxr-xr-xroms/skiboot/external/gard/test/make-check-test1
-rw-r--r--roms/skiboot/external/gard/test/results/00-list.err0
-rw-r--r--roms/skiboot/external/gard/test/results/00-list.out5
-rw-r--r--roms/skiboot/external/gard/test/results/01-show_1.err0
-rw-r--r--roms/skiboot/external/gard/test/results/01-show_1.out8
-rw-r--r--roms/skiboot/external/gard/test/results/02-usage.err24
-rw-r--r--roms/skiboot/external/gard/test/results/02-usage.out1
-rw-r--r--roms/skiboot/external/gard/test/results/03-show_1-p9.err0
-rw-r--r--roms/skiboot/external/gard/test/results/03-show_1-p9.out10
-rw-r--r--roms/skiboot/external/gard/test/results/04-create-bad-instance.err2
-rw-r--r--roms/skiboot/external/gard/test/results/04-create-bad-instance.out0
-rw-r--r--roms/skiboot/external/gard/test/results/05-create-bad-unit.err2
-rw-r--r--roms/skiboot/external/gard/test/results/05-create-bad-unit.out0
-rw-r--r--roms/skiboot/external/gard/test/results/06-create-long-path.err2
-rw-r--r--roms/skiboot/external/gard/test/results/06-create-long-path.out0
-rw-r--r--roms/skiboot/external/gard/test/results/07-create-slash.err2
-rw-r--r--roms/skiboot/external/gard/test/results/07-create-slash.out0
-rw-r--r--roms/skiboot/external/gard/test/results/08-create-duplicate.err1
-rw-r--r--roms/skiboot/external/gard/test/results/08-create-duplicate.out0
-rw-r--r--roms/skiboot/external/gard/test/results/09-create-last-unit.err0
-rw-r--r--roms/skiboot/external/gard/test/results/09-create-last-unit.out4
-rw-r--r--roms/skiboot/external/gard/test/results/10-clear-single.err0
-rw-r--r--roms/skiboot/external/gard/test/results/10-clear-single.out7
-rw-r--r--roms/skiboot/external/gard/test/results/11-clear-first.err0
-rw-r--r--roms/skiboot/external/gard/test/results/11-clear-first.out13
-rwxr-xr-xroms/skiboot/external/gard/test/test-gard5
-rw-r--r--roms/skiboot/external/gard/test/tests/00-list10
-rw-r--r--roms/skiboot/external/gard/test/tests/01-show_110
-rw-r--r--roms/skiboot/external/gard/test/tests/02-usage17
-rw-r--r--roms/skiboot/external/gard/test/tests/03-show_1-p910
-rw-r--r--roms/skiboot/external/gard/test/tests/04-create-bad-instance10
-rw-r--r--roms/skiboot/external/gard/test/tests/05-create-bad-unit10
-rw-r--r--roms/skiboot/external/gard/test/tests/06-create-long-path10
-rw-r--r--roms/skiboot/external/gard/test/tests/07-create-slash10
-rw-r--r--roms/skiboot/external/gard/test/tests/08-create-duplicate10
-rw-r--r--roms/skiboot/external/gard/test/tests/09-create-last-unit16
-rw-r--r--roms/skiboot/external/gard/test/tests/10-clear-single23
-rw-r--r--roms/skiboot/external/gard/test/tests/11-clear-first26
42 files changed, 316 insertions, 0 deletions
diff --git a/roms/skiboot/external/gard/test/add_test.sh b/roms/skiboot/external/gard/test/add_test.sh
new file mode 100755
index 000000000..6523dffc6
--- /dev/null
+++ b/roms/skiboot/external/gard/test/add_test.sh
@@ -0,0 +1,67 @@
+#!/bin/bash -uex
+#
+# this is a really dumb script for auto-generating test cases from known good-data
+#
+# usage: ./add_test <pass|fail> <inputfile> <testname> [opal-gard subcommand]
+#
+# e.g.
+# ./add_test.sh fail blank.bin create-bad-instance create /sys256
+# ./add_test.sh pass blank.bin create-normal create /sys0/node0/proc0
+#
+# this will generate a test script file and writes the stdout/stderr of the command
+# to the respective files.
+#
+
+cd $(dirname $(realpath $0))/../
+echo $PWD
+
+if [ "$1" = "pass" ]; then
+ check='if [ "$?" -ne 0 ]; then'
+ test_type="pass"
+else
+ check='if [ "$?" -eq 0 ]; then'
+ test_type="fails"
+fi
+shift
+
+file="test/files/$1"
+if [ ! -f "$file" ]; then
+ echo "test file not found!"
+ exit 1;
+fi
+shift
+
+name="$1"
+shift
+
+max="$(ls test/tests/ -1|sort -n | sed 's@\(..\).*@\1@' | tail -1 | sed s@^0*@@)"
+num="$(printf %02d $((max + 1)))"
+
+echo "Adding: $num-$name"
+
+# where we will write the script file
+script_file="test/tests/$num-$name"
+
+echo "making $num-$name: f=$script_file, normally $test_type, cmd='$*'"
+
+cat > $script_file <<EOF
+#! /bin/sh
+
+run_binary "./opal-gard" "-9 -p -e -f $file $*"
+$check
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
+EOF
+
+# generate the .out and .err files
+stdout_file="test/results/$num-$name.out"
+stderr_file="test/results/$num-$name.err"
+
+test_input="$name-$num-input"
+cp $file $test_input
+./opal-gard -f $test_input -p -e $* 2>$stderr_file >$stdout_file
+rm -f $test_input
diff --git a/roms/skiboot/external/gard/test/files/blank.bin b/roms/skiboot/external/gard/test/files/blank.bin
new file mode 100644
index 000000000..c6cc6b8c2
--- /dev/null
+++ b/roms/skiboot/external/gard/test/files/blank.bin
Binary files differ
diff --git a/roms/skiboot/external/gard/test/files/data-p9.bin b/roms/skiboot/external/gard/test/files/data-p9.bin
new file mode 100644
index 000000000..f2141657a
--- /dev/null
+++ b/roms/skiboot/external/gard/test/files/data-p9.bin
Binary files differ
diff --git a/roms/skiboot/external/gard/test/files/data1.bin b/roms/skiboot/external/gard/test/files/data1.bin
new file mode 100644
index 000000000..aa5bf1437
--- /dev/null
+++ b/roms/skiboot/external/gard/test/files/data1.bin
Binary files differ
diff --git a/roms/skiboot/external/gard/test/make-check-test b/roms/skiboot/external/gard/test/make-check-test
new file mode 100755
index 000000000..6b9e5db88
--- /dev/null
+++ b/roms/skiboot/external/gard/test/make-check-test
@@ -0,0 +1 @@
+make -C external/gard/ check
diff --git a/roms/skiboot/external/gard/test/results/00-list.err b/roms/skiboot/external/gard/test/results/00-list.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/00-list.err
diff --git a/roms/skiboot/external/gard/test/results/00-list.out b/roms/skiboot/external/gard/test/results/00-list.out
new file mode 100644
index 000000000..0e20b4aef
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/00-list.out
@@ -0,0 +1,5 @@
+ ID | Error | Type | Path
+-----------------------------------------------------------
+ 00000001 | 90000015 | Predictive | /Sys0/Node0/Proc0
+ 00000002 | 90000016 | Predictive | /Sys0/Node0/Membuf0
+===========================================================
diff --git a/roms/skiboot/external/gard/test/results/01-show_1.err b/roms/skiboot/external/gard/test/results/01-show_1.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/01-show_1.err
diff --git a/roms/skiboot/external/gard/test/results/01-show_1.out b/roms/skiboot/external/gard/test/results/01-show_1.out
new file mode 100644
index 000000000..60fcea264
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/01-show_1.out
@@ -0,0 +1,8 @@
+Record ID: 0x00000001
+========================
+Error ID: 0x90000015
+Error Type: Predictive (0xe6)
+Path Type: physical
+>Sys, Instance #0
+ >Node, Instance #0
+ >Proc, Instance #0
diff --git a/roms/skiboot/external/gard/test/results/02-usage.err b/roms/skiboot/external/gard/test/results/02-usage.err
new file mode 100644
index 000000000..453fcf52f
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/02-usage.err
@@ -0,0 +1,24 @@
+Usage: ./opal-gard [-a -e -f <file> -p] <command> [<args>]
+
+-8 --p8
+-9 --p9
+-0 --p10
+ Set the processor generation
+
+-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 specify that 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
+ create Create a GARD record
diff --git a/roms/skiboot/external/gard/test/results/02-usage.out b/roms/skiboot/external/gard/test/results/02-usage.out
new file mode 100644
index 000000000..c862167b4
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/02-usage.out
@@ -0,0 +1 @@
+Open-Power GARD tool VERSION
diff --git a/roms/skiboot/external/gard/test/results/03-show_1-p9.err b/roms/skiboot/external/gard/test/results/03-show_1-p9.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/03-show_1-p9.err
diff --git a/roms/skiboot/external/gard/test/results/03-show_1-p9.out b/roms/skiboot/external/gard/test/results/03-show_1-p9.out
new file mode 100644
index 000000000..c9ae5b21c
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/03-show_1-p9.out
@@ -0,0 +1,10 @@
+Record ID: 0x00000001
+========================
+Error ID: 0x90000007
+Error Type: Fatal (0xe3)
+Path Type: physical
+>Sys, Instance #0
+ >Node, Instance #0
+ >Proc, Instance #0
+ >EQ, Instance #1
+ >EX, Instance #0
diff --git a/roms/skiboot/external/gard/test/results/04-create-bad-instance.err b/roms/skiboot/external/gard/test/results/04-create-bad-instance.err
new file mode 100644
index 000000000..2a8da501a
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/04-create-bad-instance.err
@@ -0,0 +1,2 @@
+Instance 256 is invalid. Must be 0 to 255
+Unable to parse path
diff --git a/roms/skiboot/external/gard/test/results/04-create-bad-instance.out b/roms/skiboot/external/gard/test/results/04-create-bad-instance.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/04-create-bad-instance.out
diff --git a/roms/skiboot/external/gard/test/results/05-create-bad-unit.err b/roms/skiboot/external/gard/test/results/05-create-bad-unit.err
new file mode 100644
index 000000000..aa1af82f5
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/05-create-bad-unit.err
@@ -0,0 +1,2 @@
+Unknown unit at: 'doesnt_exist0'
+Unable to parse path
diff --git a/roms/skiboot/external/gard/test/results/05-create-bad-unit.out b/roms/skiboot/external/gard/test/results/05-create-bad-unit.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/05-create-bad-unit.out
diff --git a/roms/skiboot/external/gard/test/results/06-create-long-path.err b/roms/skiboot/external/gard/test/results/06-create-long-path.err
new file mode 100644
index 000000000..f79a3bda9
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/06-create-long-path.err
@@ -0,0 +1,2 @@
+Path has more than 10 components!
+Unable to parse path
diff --git a/roms/skiboot/external/gard/test/results/06-create-long-path.out b/roms/skiboot/external/gard/test/results/06-create-long-path.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/06-create-long-path.out
diff --git a/roms/skiboot/external/gard/test/results/07-create-slash.err b/roms/skiboot/external/gard/test/results/07-create-slash.err
new file mode 100644
index 000000000..6fd687604
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/07-create-slash.err
@@ -0,0 +1,2 @@
+Unknown unit at: ''
+Unable to parse path
diff --git a/roms/skiboot/external/gard/test/results/07-create-slash.out b/roms/skiboot/external/gard/test/results/07-create-slash.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/07-create-slash.out
diff --git a/roms/skiboot/external/gard/test/results/08-create-duplicate.err b/roms/skiboot/external/gard/test/results/08-create-duplicate.err
new file mode 100644
index 000000000..4c4073953
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/08-create-duplicate.err
@@ -0,0 +1 @@
+Unit /Sys0/Node0/Membuf0 is already GARDed by record 0x000002
diff --git a/roms/skiboot/external/gard/test/results/08-create-duplicate.out b/roms/skiboot/external/gard/test/results/08-create-duplicate.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/08-create-duplicate.out
diff --git a/roms/skiboot/external/gard/test/results/09-create-last-unit.err b/roms/skiboot/external/gard/test/results/09-create-last-unit.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/09-create-last-unit.err
diff --git a/roms/skiboot/external/gard/test/results/09-create-last-unit.out b/roms/skiboot/external/gard/test/results/09-create-last-unit.out
new file mode 100644
index 000000000..62cfcbbd0
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/09-create-last-unit.out
@@ -0,0 +1,4 @@
+ ID | Error | Type | Path
+----------------------------------------------------------------------------------------------------------------------------------------------------------------
+ 00000001 | 00000000 | Manual | /MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255
+================================================================================================================================================================
diff --git a/roms/skiboot/external/gard/test/results/10-clear-single.err b/roms/skiboot/external/gard/test/results/10-clear-single.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/10-clear-single.err
diff --git a/roms/skiboot/external/gard/test/results/10-clear-single.out b/roms/skiboot/external/gard/test/results/10-clear-single.out
new file mode 100644
index 000000000..904e61a56
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/10-clear-single.out
@@ -0,0 +1,7 @@
+Clearing the entire gard partition...done
+ ID | Error | Type | Path
+---------------------------------------------------------
+ 00000001 | 00000000 | Manual | /Sys0/Node0/Proc1
+=========================================================
+Clearing gard record 0x00000001...done
+No GARD entries to display
diff --git a/roms/skiboot/external/gard/test/results/11-clear-first.err b/roms/skiboot/external/gard/test/results/11-clear-first.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/11-clear-first.err
diff --git a/roms/skiboot/external/gard/test/results/11-clear-first.out b/roms/skiboot/external/gard/test/results/11-clear-first.out
new file mode 100644
index 000000000..3b67689ce
--- /dev/null
+++ b/roms/skiboot/external/gard/test/results/11-clear-first.out
@@ -0,0 +1,13 @@
+Clearing the entire gard partition...done
+ ID | Error | Type | Path
+---------------------------------------------------------
+ 00000001 | 00000000 | Manual | /Sys0/Node0/Proc0
+ 00000002 | 00000000 | Manual | /Sys0/Node0/Proc1
+=========================================================
+Clearing gard record 0x00000001...done
+ ID | Error | Type | Path
+---------------------------------------------------------
+ 00000002 | 00000000 | Manual | /Sys0/Node0/Proc1
+=========================================================
+Clearing gard record 0x00000002...done
+No GARD entries to display
diff --git a/roms/skiboot/external/gard/test/test-gard b/roms/skiboot/external/gard/test/test-gard
new file mode 100755
index 000000000..10da35156
--- /dev/null
+++ b/roms/skiboot/external/gard/test/test-gard
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+. test/test.sh
+
+run_tests "test/tests/*" "test/results"
diff --git a/roms/skiboot/external/gard/test/tests/00-list b/roms/skiboot/external/gard/test/tests/00-list
new file mode 100644
index 000000000..982acb3d3
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/00-list
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -8 -f test/files/data1.bin list"
+if [ "$?" -ne 0 ] ; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/01-show_1 b/roms/skiboot/external/gard/test/tests/01-show_1
new file mode 100644
index 000000000..48b779eb9
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/01-show_1
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -8 -f test/files/data1.bin show 1"
+if [ "$?" -ne 0 ] ; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/02-usage b/roms/skiboot/external/gard/test/tests/02-usage
new file mode 100644
index 000000000..7ef3c04e6
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/02-usage
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+# This test fails on FSP based system. Hence skip this test.
+if [ -d "/proc/device-tree/fsps" ] ; then
+ return 0
+fi
+
+run_binary "./opal-gard"
+if [ "$?" -ne 1 ] ; then
+ fail_test
+fi
+
+strip_version_from_result "gard"
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/03-show_1-p9 b/roms/skiboot/external/gard/test/tests/03-show_1-p9
new file mode 100644
index 000000000..2a7b91b7d
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/03-show_1-p9
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -f test/files/data-p9.bin --p9 show 1"
+if [ "$?" -ne 0 ] ; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/04-create-bad-instance b/roms/skiboot/external/gard/test/tests/04-create-bad-instance
new file mode 100644
index 000000000..f9070a3dc
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/04-create-bad-instance
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -8 -f test/files/blank.bin create /sys256"
+if [ "$?" -eq 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/05-create-bad-unit b/roms/skiboot/external/gard/test/tests/05-create-bad-unit
new file mode 100644
index 000000000..be60aed04
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/05-create-bad-unit
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -f test/files/blank.bin create /doesnt_exist0"
+if [ "$?" -eq 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/06-create-long-path b/roms/skiboot/external/gard/test/tests/06-create-long-path
new file mode 100644
index 000000000..f3ffaabf6
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/06-create-long-path
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -8 -f test/files/blank.bin create /sys0/sys0/sys0/sys0/sys0/sys0/sys0/sys0/sys0/sys0/sys0/sys0/"
+if [ "$?" -eq 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/07-create-slash b/roms/skiboot/external/gard/test/tests/07-create-slash
new file mode 100644
index 000000000..0e597e346
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/07-create-slash
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -f test/files/blank.bin create /"
+if [ "$?" -eq 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/08-create-duplicate b/roms/skiboot/external/gard/test/tests/08-create-duplicate
new file mode 100644
index 000000000..fad5d3499
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/08-create-duplicate
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./opal-gard" "-p -e -8 -f test/files/data1.bin create /Sys0/Node0/Membuf0"
+if [ "$?" -eq 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/09-create-last-unit b/roms/skiboot/external/gard/test/tests/09-create-last-unit
new file mode 100644
index 000000000..4d9b319cc
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/09-create-last-unit
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+cp test/files/blank.bin $DATA_DIR/input
+run_binary "./opal-gard" "-9 -p -e -f $DATA_DIR/input create /MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255/MFREFCLK255"
+if [ "$?" -ne 0 ]; then
+ fail_test
+fi
+
+run_binary "./opal-gard" "-9 -p -e -f $DATA_DIR/input list"
+if [ "$?" -ne 0 ]; then
+ fail_test
+fi
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/10-clear-single b/roms/skiboot/external/gard/test/tests/10-clear-single
new file mode 100644
index 000000000..3a5f962ec
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/10-clear-single
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+DATA=$(mktemp)
+
+cleanup() {
+ rm -f $DATA
+}
+
+trap cleanup EXIT
+
+dd if=/dev/zero of=$DATA bs=$((0x1000)) count=5 2>/dev/null
+
+run_binary "./opal-gard" "-p -e -f $DATA clear all"
+run_binary "./opal-gard" "-p -e -f $DATA create /sys0/node0/proc1"
+run_binary "./opal-gard" "-p -e -f $DATA list"
+run_binary "./opal-gard" "-p -e -f $DATA clear 00000001"
+run_binary "./opal-gard" "-p -e -f $DATA list"
+
+diff_with_result
+
+pass_test
diff --git a/roms/skiboot/external/gard/test/tests/11-clear-first b/roms/skiboot/external/gard/test/tests/11-clear-first
new file mode 100644
index 000000000..c59fcc8f0
--- /dev/null
+++ b/roms/skiboot/external/gard/test/tests/11-clear-first
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+DATA=$(mktemp)
+
+cleanup() {
+ rm -f $DATA
+}
+
+trap cleanup EXIT
+
+dd if=/dev/zero of=$DATA bs=$((0x1000)) count=5 2>/dev/null
+
+run_binary "./opal-gard" "-p -e -f $DATA clear all"
+run_binary "./opal-gard" "-p -e -f $DATA create /sys0/node0/proc0"
+run_binary "./opal-gard" "-p -e -f $DATA create /sys0/node0/proc1"
+run_binary "./opal-gard" "-p -e -f $DATA list"
+run_binary "./opal-gard" "-p -e -f $DATA clear 00000001"
+run_binary "./opal-gard" "-p -e -f $DATA list"
+run_binary "./opal-gard" "-p -e -f $DATA clear 00000002"
+run_binary "./opal-gard" "-p -e -f $DATA list"
+
+diff_with_result
+
+pass_test