From abaa1de5d191ee909aaf8d3ee87c9ed066200e20 Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Date: Tue, 8 Aug 2017 11:30:10 -0400
Subject: [PATCH] added a simple, totally incomplete test suite

---
 Makefile  | 5 ++++-
 testsuite | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4a2a1c2..356e30a 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,9 @@ LDFLAGS += $(shell pkg-config --libs libsystemd)
 
 all: hddemux hddemux.1
 
+check: hddemux
+	./testsuite
+
 hddemux: hddemux.c
 	gcc $(CFLAGS) $(LDFLAGS) -std=c11 -pedantic -Wall -Werror -o $@ $<
 
@@ -31,4 +34,4 @@ clean:
 	draft-dkg-dprive-demux-dns-http.html \
 	draft-dkg-dprive-demux-dns-http.xml
 
-.PHONY: clean all
+.PHONY: clean all check
diff --git a/testsuite b/testsuite
index e5dc3f8..684c128 100755
--- a/testsuite
+++ b/testsuite
@@ -1,11 +1,15 @@
 #!/bin/bash
 
+set -e
+
 # test suite for hddemux
 
 # this is just a stub.
 
+[ -x ./hddemux ]
+
 # hddemux with no arguments and no listening file descriptors should fail:
-if [ ./hddemux ]; then
+if ./hddemux; then
     false
 fi
 
-- 
GitLab