Switch 'make check' to be done via shelltestrunner

The embedding of tests in the Makefile works only for that is there
today - a few `--version` and `stinit -p` calls. For expanding the
test coverage, as much as it can be done for `mt`, let's use a proper
shell test runner. `shelltestrunner` is available in Debian/Ubuntu, so
it's likely to be available in other distributions too, and as such
should not be a big barrier to contribution.
This commit is contained in:
Iustin Pop
2021-06-06 01:46:03 +02:00
parent 1743522b8a
commit 886ce1f261
4 changed files with 34 additions and 7 deletions

View File

@@ -46,6 +46,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -yy shelltestrunner
- name: Build the code
run: make CFLAGS=-coverage

View File

@@ -87,13 +87,7 @@ distcheck: dist
test "$$numfiles" -eq 5
check: $(PROGS)
echo Checking version output
./mt --version
./stinit --version
echo Checking parse status
./stinit -p -f stinit.def.examples
echo Checking complete stinit parsing
( ./stinit -v -v -p -f stinit.def.examples 2>&1 | grep -q 'Mode 1 definition: scsi2logical=1 can-bsr=1 auto-lock=0 two-fms=0 drive-buffering=1 buffer-writes read-ahead=1 async-writes=1 can-partitions=0 fast-eom=1 blocksize=0 sili=1 timeout=900 long-timeout=14400 density=0x44 compression=0' )
shelltest -DVERSION=$(VERSION) tests
# This needs lcov installed, and it's useful for local testing.
coverage: clean

21
tests/basic.test Normal file
View File

@@ -0,0 +1,21 @@
# Check --version works
./mt --version
>>> /VERSION/
>>>= 0
./mt -v
>>> /VERSION/
>>>= 0
./stinit --version
>>> /VERSION/
>>>= 0
# Check -h works
./mt -h
>>>2 /commands: weof, wset, eof/
>>>= 0
./stinit -h
>>>2 /Usage: stinit/
>>>= 0

View File

@@ -0,0 +1,9 @@
# Check example file parsing
./stinit -p -f stinit.def.examples
>>>= 0
# Checking complete stinit parsing
./stinit -v -v -p -f stinit.def.examples
>>> /No errors found./
>>>2 /Mode 1 definition: scsi2logical=1 can-bsr=1 auto-lock=0 two-fms=0 drive-buffering=1 buffer-writes read-ahead=1 async-writes=1 can-partitions=0 fast-eom=1 blocksize=0 sili=1 timeout=900 long-timeout=14400 density=0x44 compression=0/
>>>= 0