summaryrefslogtreecommitdiff
path: root/libs/greatest/contrib
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-14 15:27:51 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-14 15:27:51 +0200
commit76d3082e5b89fe54acaaaaadd201ccc92f4f346e (patch)
tree32d5212d87bc0b4cab06bcbe923f7eeb019268b0 /libs/greatest/contrib
parent38019a9693375ac6719ffec43bff63774e142387 (diff)
tests for administration io
Diffstat (limited to 'libs/greatest/contrib')
-rw-r--r--libs/greatest/contrib/entapment107
-rw-r--r--libs/greatest/contrib/greenest33
-rw-r--r--libs/greatest/contrib/testify33
3 files changed, 173 insertions, 0 deletions
diff --git a/libs/greatest/contrib/entapment b/libs/greatest/contrib/entapment
new file mode 100644
index 0000000..8221ff9
--- /dev/null
+++ b/libs/greatest/contrib/entapment
@@ -0,0 +1,107 @@
+#!/usr/bin/awk -f
+######################################################################
+# Copyright (c) 2017 Scott Vokes <vokes.s@gmail.com>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+######################################################################
+#
+# This script converts greatest verbose output to TAP version 13.
+#
+# Usage:
+# test_runner -v | contrib/entapment
+#
+######################################################################
+
+BEGIN {
+ diag_i = 1
+
+ PASS = 0
+ FAIL = 1
+ SKIP = 2
+ TODO = 3
+}
+
+/^\* Suite/ {
+ suites[total_count] = $3
+}
+
+/^PASS/ {
+ total_count++
+ pass_count++
+ results[total_count] = PASS
+ $1 = ""
+ msg[total_count] = $0
+ next
+}
+
+/^FAIL/ {
+ total_count++
+ fail_count++
+ results[total_count] = FAIL
+ $1 = ""
+ msg[total_count] = $0
+ next
+}
+
+/^SKIP/ {
+ total_count++
+ if (match($0, "TODO")) {
+ results[total_count] = TODO
+ } else {
+ results[total_count] = SKIP
+ }
+ $1 = ""
+ msg[total_count] = $0
+ next
+}
+
+{
+ # Shift this by 1 so any test output is printed after ok/not ok line
+ if (diag_groups[total_count + 1] == 0) {
+ diag_groups[total_count + 1] = diag_lines
+ }
+ diag[diag_lines++] = $0
+}
+
+END {
+ diag_groups[total_count] = diag_lines
+
+ printf("TAP version 13\n")
+ printf("%d..%d\n", 1, total_count)
+
+ for (i = 1; i <= total_count; i++) {
+ if (suites[i] != "") {
+ printf("# suite %s\n", suites[i])
+ }
+ if (results[i] == PASS) {
+ printf("ok %d -%s\n", i, msg[i])
+ } else if (results[i] == FAIL) {
+ printf("not ok %d -%s\n", i, msg[i])
+ } else if (results[i] == SKIP) {
+ printf("not ok %d # SKIP -%s\n", i, msg[i])
+ } else if (results[i] == TODO) {
+ printf("not ok %d # TODO -%s\n", i, msg[i])
+ }
+
+ if (diag_groups[i]) {
+ for (d = diag_groups[i]; d < diag_groups[i + 1]; d++) {
+ printf("# %s\n", diag[d])
+ }
+ }
+ }
+ if (total_count > 0) {
+ printf("# pass %d, fail %d, skip %d, %.2f%% okay\n",
+ pass_count, fail_count, total_count - (pass_count + fail_count),
+ 100 * (pass_count / total_count))
+ }
+}
diff --git a/libs/greatest/contrib/greenest b/libs/greatest/contrib/greenest
new file mode 100644
index 0000000..48d1218
--- /dev/null
+++ b/libs/greatest/contrib/greenest
@@ -0,0 +1,33 @@
+#!/usr/bin/awk -f
+# Copyright (c) 2016 Scott Vokes <vokes.s@gmail.com>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+BEGIN {
+ GREEN = "\033[32m"
+ RED = "\033[31m"
+ YELLOW = "\033[33m"
+ RESET = "\033[m"
+}
+
+/^PASS/ { sub("PASS", GREEN "PASS" RESET) }
+/^SKIP/ { sub("SKIP", YELLOW "SKIP" RESET) }
+/^FAIL/ { sub("FAIL", RED "FAIL" RESET) }
+
+# highlight hexdump difference markers
+/^[0-9a-f]/ {
+ sub("X", GREEN "X" RESET, $2)
+ gsub("<", GREEN "<" RESET, $0)
+}
+
+{ print($0) }
diff --git a/libs/greatest/contrib/testify b/libs/greatest/contrib/testify
new file mode 100644
index 0000000..9a65367
--- /dev/null
+++ b/libs/greatest/contrib/testify
@@ -0,0 +1,33 @@
+#!/usr/bin/awk -f
+# Copyright (c) 2017 Scott Vokes <vokes.s@gmail.com>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# This is a script that reads a bunch of lines like:
+# RUN_TEST(test_name);
+# RUN_TEST(other_name);
+#
+# and outputs
+# TEST test_name(void) {
+# SKIPm("TODO");
+# }
+#
+# TEST other_name(void) {
+# SKIPm("TODO");
+# }
+
+/RUN_TEST\(/ {
+ split($1, test, /\(|\)/)
+ name = test[2]
+ printf("TEST %s(void) {\n SKIPm(\"TODO\");\n}\n\n", name)
+}