commit 25c4ee9679ff3bf0a757cc713364f4832bdacf19
parent 2c68a3721ddf0905645423437849cd3756ed7c6c
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date:   Mon, 18 Apr 2022 11:30:35 +0000
Fix tests
Don't pin tox python to specific version of python3,
any python3 will do.
Make yarns runnable under tinyyarn.
Don't try to run sparsemap tests on non-linux platforms.
Make tests runnable on OpenBSD.
Diffstat:
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/check b/check
@@ -1,13 +1,19 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -e
 set -u
 
-# psst: --snapshot is your friend if you're debugging the tests
-
 run_yarn_suite() {
-    PATH="$(realpath $(dirname check)):$PATH" yarn tests/*.yarn \
-        --stop-on-first-fail -s tests/shell_lib --shell='/bin/bash' "$@"
+    tyarn -E -e "PATH=$PATH" -l tests/shell_lib -s "$(which bash)" \
+        "tests/$1.yarn" \
+        tests/implementations.yarn
 }
 
-run_yarn_suite "$@"
+run_yarn_suite mksparse
+
+if [[ $(uname) != "Linux" ]]
+then
+    echo "Non-linux platform detected... skipping sparsemap tests!" 1>&2
+else
+    run_yarn_suite sparsemap
+fi
diff --git a/tests/implementations.yarn b/tests/implementations.yarn
@@ -1,23 +1,23 @@
-    IMPLEMENTS GIVEN a sparse file (\S+) with a hole size (\d+) and data size (\d+) with spec ([a-zA-z,]+)
+    IMPLEMENTS GIVEN a sparse file ([a-zA-Z]+) with a hole size ([0-9]+) and data size ([0-9]+) with spec ([a-zA-z,]+)
     set -e -o pipefail
     echo "$MATCH_4" | mksparse "$DATADIR/$MATCH_1" --hole-size "$MATCH_2" --data-size "$MATCH_3"
 
-    IMPLEMENTS WHEN we run sparsemap on (\w+)
+    IMPLEMENTS WHEN we run sparsemap on ([a-zA-Z]+)
     run_sparsemap "$DATADIR/$MATCH_1"
 
-    IMPLEMENTS WHEN we attempt to run (\w+) without any arguments
+    IMPLEMENTS WHEN we attempt to run ([a-zA-Z]+) without any arguments
     set +e
     eval run_$MATCH_1
     echo $? > "$DATADIR/EXITCODE"
     set -e
 
-    IMPLEMENTS WHEN we attempt to run (\w+) (?:on|with) (.+)
+    IMPLEMENTS WHEN we attempt to run ([a-zA-Z]+) (on|with) (.+)
     set +e
-    eval run_$MATCH_1 "$DATADIR/$MATCH_2"
+    eval run_$MATCH_1 "$DATADIR/$MATCH_3"
     echo $? > "$DATADIR/EXITCODE"
     set -e
 
-    IMPLEMENTS THEN the exit code is (\d+)
+    IMPLEMENTS THEN the exit code is ([0-9]+)
     exit_code=$(cat "$DATADIR/EXITCODE")
     [[ $exit_code -eq $MATCH_1 ]]
 
diff --git a/tox.ini b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py34
+envlist = py3
 
 [testenv]
 commands=