aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-03-02 12:40:29 +0100
committerThomas White <taw@physics.org>2022-03-02 12:40:29 +0100
commitf36b114e46eaa93b7a7ecc1837b7c8584bf86ad0 (patch)
tree7724506b734b996140c1872e8923ea08d0e2f0c6 /tests
parentb1d75cb3af16b6c864fb5ad5016b085790d1b6f8 (diff)
Add tests/indexamajig-missing-file
This checks that indexamajig correctly recognises when no files could be processed.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/indexamajig-missing-file35
-rw-r--r--tests/meson.build6
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/indexamajig-missing-file b/tests/indexamajig-missing-file
new file mode 100755
index 00000000..fd65239e
--- /dev/null
+++ b/tests/indexamajig-missing-file
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+INDEXAMAJIG=$1
+GEOM=$2
+
+INFILES=`echo file_does_not_exist{1..10}.h5`
+
+if [ -f test-input.lst ]; then
+ echo test-input.lst exists. Not proceeding!
+ exit 1
+fi
+
+if [ -f test-output.stream ]; then
+ echo test-output.stream exists. Not proceeding!
+ exit 1
+fi
+
+for FILE in $INFILES; do
+ if [ -f $FILE ]; then
+ echo $FILE exists. Not proceeding!
+ exit 1
+ fi
+ echo $FILE >> test-input.lst
+done
+
+$INDEXAMAJIG -i test-input.lst -o test-output.stream -g $GEOM
+OUTVAL=$?
+
+rm -f test-output.stream test-input.lst
+
+# indexamajig should have failed with a specific error code
+if [ $OUTVAL -ne 5 ]; then
+ echo indexamajig returned $OUTVAL, should be 5
+ exit 1;
+fi
diff --git a/tests/meson.build b/tests/meson.build
index 9165a666..aa425707 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -31,6 +31,12 @@ test('file-wait',
files('wavelength_geom1.geom')])
+test('indexamajig-missing-file',
+ find_program('indexamajig-missing-file'),
+ args : [indexamajig.full_path(),
+ files('wavelength_geom1.geom')])
+
+
# Easy unit tests of libcrystfel functions
simple_tests = ['ambi_check',
'cell_check',