gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master e473879 3/7: astscript-radial-profile: includi


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master e473879 3/7: astscript-radial-profile: including make check for this script
Date: Sun, 16 May 2021 15:39:28 -0400 (EDT)

branch: master
commit e473879e23f717e857873268e62558bfdcbad85a
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    astscript-radial-profile: including make check for this script
    
    Until now, the radial-profile script did not have a test/check to be
    executed during the 'make check' step.  With this commit, a check has been
    added. It consists in obtaining the radial profile of an image previously
    generated by 'astmkprof'. This commit achieves Task #15920 defined in
    https://savannah.gnu.org/task/?15920
---
 tests/Makefile.am              |   5 +-
 tests/script/radial-profile.sh | 101 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index e7f05d2..c5e8f03 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -200,11 +200,12 @@ if COND_WARP
 endif
 
 # Script tests.
-SCRIPT_TESTS = script/list-by-night.sh
+SCRIPT_TESTS = script/list-by-night.sh \
+               script/radial-profile.sh
 
 # We want to have several FITS files as input for this script.
 script/list-by-night.sh: mkcatalog/aperturephot.sh.log
-
+script/radial-profile.sh: mkprof/mosaic2.sh.log
 
 
 
diff --git a/tests/script/radial-profile.sh b/tests/script/radial-profile.sh
new file mode 100755
index 0000000..839f08e
--- /dev/null
+++ b/tests/script/radial-profile.sh
@@ -0,0 +1,101 @@
+# Construct the radial profile of an image generated by mkprofile.
+#
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+#
+# Original author:
+#     Raul Infante-Sainz <infantesainz@gmail.com>
+# Contributing author(s):
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Copyright (C) 2015-2021, Free Software Foundation, Inc.
+#
+# 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.
+
+
+
+
+
+# Preliminaries
+# =============
+#
+# 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).
+prog=radial-profile
+dep1=fits
+dep2=crop
+dep3=warp
+dep4=table
+dep5=mkprof
+dep6=mkcatalog
+dep7=arithmetic
+dep8=statistics
+dep1name=../bin/$dep1/ast$dep1
+dep2name=../bin/$dep2/ast$dep2
+dep3name=../bin/$dep3/ast$dep3
+dep4name=../bin/$dep4/ast$dep4
+dep5name=../bin/$dep5/ast$dep5
+dep6name=../bin/$dep6/ast$dep6
+dep7name=../bin/$dep7/ast$dep7
+dep8name=../bin/$dep8/ast$dep8
+execname=../bin/script/astscript-$prog
+fits1name=0_mkprofcat2.fits
+
+
+
+
+
+# Skip?
+# =====
+#
+# 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.
+#   - The input data 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
+if [ ! -f $dep2name ]; then echo "$dep2name doesn't exist."; exit 77; fi
+if [ ! -f $dep3name ]; then echo "$dep3name doesn't exist."; exit 77; fi
+if [ ! -f $dep4name ]; then echo "$dep4name doesn't exist."; exit 77; fi
+if [ ! -f $dep5name ]; then echo "$dep5name doesn't exist."; exit 77; fi
+if [ ! -f $dep6name ]; then echo "$dep6name doesn't exist."; exit 77; fi
+if [ ! -f $dep7name ]; then echo "$dep7name doesn't exist."; exit 77; fi
+if [ ! -f $dep8name ]; then echo "$dep8name doesn't exist."; exit 77; fi
+if [ ! -f $fits1name ]; then echo "$fits1name 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
+ln -sf $dep2name ast$dep2
+ln -sf $dep3name ast$dep3
+ln -sf $dep4name ast$dep4
+ln -sf $dep5name ast$dep5
+ln -sf $dep6name ast$dep6
+ln -sf $dep7name ast$dep7
+ln -sf $dep8name ast$dep8
+
+
+
+
+
+# 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.
+export PATH="./:$PATH"
+$check_with_program $execname $fits1name



reply via email to

[Prev in Thread] Current Thread [Next in Thread]