Add simple autopkgtests.
authorgregor herrmann <gregoa@debian.org>
Tue, 9 Apr 2019 20:05:39 +0000 (22:05 +0200)
committergregor herrmann <gregoa@debian.org>
Tue, 9 Apr 2019 20:05:39 +0000 (22:05 +0200)
debian/tests/control [new file with mode: 0644]
debian/tests/help [new file with mode: 0755]
debian/tests/limitperl [new file with mode: 0755]

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644 (file)
index 0000000..597f274
--- /dev/null
@@ -0,0 +1,6 @@
+Tests: limitperl
+Depends: @, perl, grep
+
+Tests: help
+Depends: @
+Restrictions: superficial
diff --git a/debian/tests/help b/debian/tests/help
new file mode 100755 (executable)
index 0000000..ac60275
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+cpulimit --help 2>&1 | grep -qF 'CPUlimit version'
diff --git a/debian/tests/limitperl b/debian/tests/limitperl
new file mode 100755 (executable)
index 0000000..17688d5
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+LOG=cpulimit.log
+rm -f $LOG
+
+cpulimit -l 25 -f -- perl -e '$z=time()+10; while (time()<$z) { $i++; }' >$LOG
+grep -Eq '^Process [0-9]+ detected$' $LOG
+grep -Eq '^Child process is finished, exiting\.\.\.$' $LOG