[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master c6a691f 2/2: Tests: new test for astscript-sor
[gnuastro-commits] master c6a691f 2/2: Tests: new test for astscript-sort-by-night
Thu, 4 Apr 2019 16:23:11 -0400 (EDT)
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Tests: new test for astscript-sort-by-night
As the first script, in Gnuastro, a template to test more such scripts in
the future has also been added.
tests/Makefile.am | 7 ++++-
tests/script/list-by-night.sh | 70 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index deb46ca..b979215 100644
@@ -191,6 +191,11 @@ if COND_WARP
+# Script tests.
+SCRIPT_TESTS = script/list-by-night.sh
+# We want to have several FITS files as input for this script.
@@ -244,7 +249,7 @@ TESTS = prepconf.sh lib/multithread.sh $(MAYBE_CXX_TESTS)
$(MAYBE_MKCATALOG_TESTS) $(MAYBE_MKNOISE_TESTS) $(MAYBE_MKPROF_TESTS) \
$(MAYBE_NOISECHISEL_TESTS) $(MAYBE_SEGMENT_TESTS) \
$(MAYBE_STATISTICS_TESTS) $(MAYBE_SUBTRACTSKY_TESTS) \
- $(MAYBE_TABLE_TESTS) $(MAYBE_WARP_TESTS)
+ $(MAYBE_TABLE_TESTS) $(MAYBE_WARP_TESTS) $(SCRIPT_TESTS)
diff --git a/tests/script/list-by-night.sh b/tests/script/list-by-night.sh
new file mode 100755
@@ -0,0 +1,70 @@
+# List all FITS files in build directory by date.
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+# Original author:
+# Mohammad Akhlaghi <address@hidden>
+# Contributing author(s):
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+# Set the variables (The executable is in the build tree). Do the
+# basic checks to see if the executable is made or if the defaults
+# file exists (basicchecks.sh is in the source tree).
+# We will be adding noise to two images: the warped (smaller) and unwarped
+# (larger) mock images. The warped one will be used by programs that don't
+# care about the size of the image, but the larger one will be used by
+# those that do: for example SubtractSky and NoiseChisel will be better
+# tested on a larger image.
+# If the dependencies of the test don't exist, then skip it. There are two
+# types of dependencies:
+# - The executable script was not made.
+# - The programs it use weren't made.
+if [ ! -f $execname ]; then echo "$execname doesn't exist."; exit 77; fi
+if [ ! -f $dep1name ]; then echo "$dep1name doesn't exist."; exit 77; fi
+# Put a link of Gnuastro program(s) used into current directory. Note that
+# other script tests may have already brought it.
+ln -sf $dep1name ast$dep1
+# Actual test script
+# `check_with_program' can be something like `Valgrind' or an empty
+# string. Such programs will execute the command if present and help in
+# debugging when the developer doesn't have access to the user's system.
+# Since we want the script to recognize the programs that it will use from
+# this same build of Gnuastro, we'll add the current directory to PATH.
+$check_with_program $execname *.fits