ncsid: Import from gBMC
This is the initial code drop from gBMC.
Google-Bug-Id: 179618516
Upstream: 1e71af914bc8c54d8b91d0a1cf377e2696713c2f
Change-Id: Ic653e8271dacd205e04f2bc713071ef2ec5936a4
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/ncsid/test/test_lib.sh b/ncsid/test/test_lib.sh
new file mode 100644
index 0000000..9e6c882
--- /dev/null
+++ b/ncsid/test/test_lib.sh
@@ -0,0 +1,32 @@
+# Compares two strings and prints out an error message if they are not equal
+StrEq() {
+ if [ "$1" != "$2" ]; then
+ echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]} Mismatched strings" >&2
+ echo " Expected: $2" >&2
+ echo " Got: $1" >&2
+ exit 1
+ fi
+}
+
+TESTS=()
+
+# Runs tests and emits output specified by the Test Anything Protocol
+# https://testanything.org/
+TestAnythingMain() {
+ set -o nounset
+ set -o errexit
+ set -o pipefail
+
+ echo "TAP version 13"
+ echo "1..${#TESTS[@]}"
+
+ local i
+ for ((i=0; i <${#TESTS[@]}; ++i)); do
+ local t="${TESTS[i]}"
+ local tap_i=$((i + 1))
+ if ! "$t"; then
+ printf "not "
+ fi
+ printf "ok %d - %s\n" "$tap_i" "$t"
+ done
+}