summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Tilmann Bubeck <tilmann@bubecks.de>2021-11-29 12:30:17 +0100
committerDr. Tilmann Bubeck <tilmann@bubecks.de>2021-11-29 12:30:17 +0100
commit5da9a32e638f4bce66ec92dff64ed68a1bbd6b6b (patch)
tree4ec1c00479700d417f69edfd5c7d0e09b3a02352
parentd6d1423fabdaec25d4a677e794f91a91f7c09c70 (diff)
downloadxorg-app-xauth-5da9a32e638f4bce66ec92dff64ed68a1bbd6b6b.tar.gz
Removed build requirement "cmdtest".
Replaced by a shell script with the needed functionality.
-rw-r--r--README.md3
-rwxr-xr-xtests/010-xauth-add-inet.script2
-rwxr-xr-xtests/020-xauth-add-local.script2
-rwxr-xr-xtests/030-xauth-extract.script6
-rwxr-xr-xtests/040-xauth-source.script4
-rwxr-xr-xtests/090-xauth-bad-usage.script2
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/test_xauth38
-rw-r--r--tests/test_xauth.c10
9 files changed, 47 insertions, 22 deletions
diff --git a/README.md b/README.md
index 3eb58fc..0349adb 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,7 @@ II. BUILDING
Use "./autogen.sh" to configure the package and "make" to compile it.
A black box check for the correctness of the package can be initiated
-by "make check" (make sure to install "cmdtest" from
-http://liw.fi/cmdtest/). The installation is done by "make install".
+by "make check". The installation is done by "make install".
III. COMMUNICATION
------------------
diff --git a/tests/010-xauth-add-inet.script b/tests/010-xauth-add-inet.script
index 685cdd7..326a2de 100755
--- a/tests/010-xauth-add-inet.script
+++ b/tests/010-xauth-add-inet.script
@@ -1,7 +1,7 @@
#!/bin/sh
# setup the test ennvironment inside this shell
-. setup-sourced
+. ./setup-sourced
xauth add examplehost1/unix:0 MIT-MAGIC-COOKIE-1 b90b0fd1cf6a0e7a2c74c00000000001
xauth add examplehost2/unix:0 . b90b0fd1cf6a0e7a2c74c00000000002
diff --git a/tests/020-xauth-add-local.script b/tests/020-xauth-add-local.script
index 71d0752..c8ccf9c 100755
--- a/tests/020-xauth-add-local.script
+++ b/tests/020-xauth-add-local.script
@@ -1,7 +1,7 @@
#!/bin/sh
# setup the test ennvironment inside this shell
-. setup-sourced
+. ./setup-sourced
# Execute the test
xauth add unix:0 . b90b0fd1cf6a0e7a2c74c00000000004
diff --git a/tests/030-xauth-extract.script b/tests/030-xauth-extract.script
index 2327788..41733fb 100755
--- a/tests/030-xauth-extract.script
+++ b/tests/030-xauth-extract.script
@@ -1,7 +1,7 @@
#!/bin/sh
# setup the test ennvironment inside this shell
-. setup-sourced
+. ./setup-sourced
# Execute the test
xauth add examplehost1/unix:0 . b90b0fd1cf6a0e7a2c74c00000000001
@@ -9,11 +9,11 @@ xauth add examplehost2/unix:0 . b90b0fd1cf6a0e7a2c74c00000000002
xauth add examplehost3/unix:0 . b90b0fd1cf6a0e7a2c74c00000000003
# Use xauth_silent because otherwise the system dependent paths are printed
-XAUTHORITY2=$DATADIR/.Xauthority2
+XAUTHORITY2=${DATADIR:-/tmp}/.Xauthority2
xauth_silent extract $XAUTHORITY2 examplehost2/unix:0
xauth_silent -f $XAUTHORITY2 list
-XAUTHORITY3=$DATADIR/.Xauthority3
+XAUTHORITY3=${DATADIR:-/tmp}/.Xauthority3
xauth_silent extract $XAUTHORITY3 examplehost3/unix:0
xauth_silent -f $XAUTHORITY3 list
diff --git a/tests/040-xauth-source.script b/tests/040-xauth-source.script
index 01c27ab..5eceb4c 100755
--- a/tests/040-xauth-source.script
+++ b/tests/040-xauth-source.script
@@ -1,10 +1,10 @@
#!/bin/sh
# setup the test ennvironment inside this shell
-. setup-sourced
+. ./setup-sourced
# Execute the test
-CMDFILE=$DATADIR/xauth-cmdfile
+CMDFILE=${DATADIR:-/tmp}/xauth-cmdfile
echo add examplehost1/unix:0 . b90b0fd1cf6a0e7a2c74c00000000001 > $CMDFILE
xauth_silent source $CMDFILE
xauth list
diff --git a/tests/090-xauth-bad-usage.script b/tests/090-xauth-bad-usage.script
index 8a1e2ff..360e9e4 100755
--- a/tests/090-xauth-bad-usage.script
+++ b/tests/090-xauth-bad-usage.script
@@ -1,7 +1,7 @@
#!/bin/sh
# setup the test ennvironment inside this shell
-. setup-sourced
+. ./setup-sourced
# Execute the test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 98b4c4e..92ae560 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,8 +8,6 @@ EXTRA_DIST = setup-sourced \
090-xauth-bad-usage.script 090-xauth-bad-usage.stderr 090-xauth-bad-usage.stdout
TESTS = test_xauth
-check_PROGRAMS = test_xauth
-test_xauth_SOURCES = test_xauth.c
diff --git a/tests/test_xauth b/tests/test_xauth
new file mode 100755
index 0000000..27d999b
--- /dev/null
+++ b/tests/test_xauth
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# This script is modelled after cmdtest:
+# it takes all *.scripts and executes them and saves the stdout/err
+# This output is compared against *.stdout/stderr.
+# If no difference is found, the test is assumed as PASS (otherwise FAIL)
+#
+total_ret=0
+for script in `ls -1 ./*.script | sort` ; do
+ base=`basename $script .script`
+ echo "Testing $base"
+ $script > out.stdout 2> out.stderr
+
+ # check stdout for correctness
+ if [ -f $base.stdout ]; then
+ diff out.stdout $base.stdout
+ ret_stdout=$?
+ else
+ ret_stdout=0
+ fi
+
+ # check stderr for correctness
+ if [ -f $base.stderr ]; then
+ diff out.stderr $base.stderr
+ ret_stderr=$?
+ else
+ ret_stderr=0
+ fi
+
+ if [ $ret_stdout -eq 0 -a $ret_stderr -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ total_ret=1
+ fi
+done
+
+exit $total_ret
diff --git a/tests/test_xauth.c b/tests/test_xauth.c
deleted file mode 100644
index 8e9c2a2..0000000
--- a/tests/test_xauth.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int main(int argc, char *argv[])
-{
- execlp("cmdtest", "cmdtest", ".", NULL);
- perror("Unable to execute 'cmdtest'. Make sure, that it is installed");
- exit(1);
-}