Browse Source

Add a basic autopkgtest

Christoph Biedl 1 year ago
parent
commit
2593709284
3 changed files with 29 additions and 0 deletions
  1. 1 0
      debian/control
  2. 2 0
      debian/tests/control
  3. 26 0
      debian/tests/run-testsuite

+ 1 - 0
debian/control

@@ -4,6 +4,7 @@ Homepage: https://www.darwinsys.com/file/
 Standards-Version: 4.4.1
 Vcs-Browser: https://git.in-ulm.de/cbiedl/file
 Vcs-Git: https://git.in-ulm.de/cbiedl/file.git
+Testsuite: autopkgtest
 Build-Depends: debhelper-compat (= 12),
     libbz2-dev,
     liblzma-dev,

+ 2 - 0
debian/tests/control

@@ -0,0 +1,2 @@
+Tests: run-testsuite
+Depends: @

+ 26 - 0
debian/tests/run-testsuite

@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -eu
+
+export TZ=UTC
+
+cd tests
+
+EXIT=0
+
+for i in *.testfile; do
+    printf 'Testing: %s ... ' "$i"
+    if [ -f ${i%%.testfile}.magic ]; then
+        m="-m ${i%%.testfile}.magic"
+    else
+        m=
+    fi;
+    if [ "$(file -b $m "$i")" = "$(cat ${i%%.testfile}.result)" ] ; then
+        echo 'pass'
+    else
+        echo 'FAILED'
+        EXIT=1
+    fi
+done
+
+exit $EXIT