gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master e61b955f: Script checks: all built Gnuastro pr


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master e61b955f: Script checks: all built Gnuastro programs now in devoted dir
Date: Thu, 3 Mar 2022 17:49:47 -0500 (EST)

branch: master
commit e61b955f20a2c5f9d61e08d577141f243905cae9
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Script checks: all built Gnuastro programs now in devoted dir
    
    Until now, during 'make check', each of the installed scripts would re-make
    symbolic links to the Gnuastro programs it needed into the build
    directory's 'tests/' directory (mixed with all the data files that are
    created there during the other tests!). This had several problems:
    
     - Forgetting to add one program in each test script of an installed script
       would cause a failure.
    
     - The various installed script's tests would over-write the symbolic links
       when run in parallell, potentially causing corrupt files.
    
    With this commit, the 'prepconf.sh' script (which is the first test script
    that is run with 'make check', and designed initially for a similar problem
    with configuration files) puts a symbolic link to all built programs and
    installed scripts in a specific directory called 'tests/programs-built' (in
    the build directory). That directory is also added to the 'PATH' of all
    installed script tests before they are run; ensuring that the currently
    built versions of the programs are run, not the ones that may (or may not!)
    exist on the host operating system.
    
    Also, in the process, the following changes were made in the scripts:
    
     - In all installed scripts, the 'on_off_option_error' doesn't end the
       error messages with a '.' (this is part of the GNU Coding Standards:
       error messages shouldn't end in a point).
    
     - In all installed scripts, the 'check_v' function error message is a
       single line, not two 'echo's. It is important that error messages be
       printed in one line, otherwise, they will get mixed with other messages
       when run in parallel.
    
     - In 'astscript-psf-create-make-stamp', the error messages are now in one
       long line instead of multiple 'echo's, and the wrong option values are
       also printed in the message. This will help debugging.
---
 bin/script/ds9-region.in                  |  9 +++---
 bin/script/fits-view.in                   |  9 +++---
 bin/script/psf-create-junction.in         |  9 +++---
 bin/script/psf-create-make-stamp.in       | 50 +++++++++++++++++++------------
 bin/script/psf-create-select-stars.in     | 19 ++++++------
 bin/script/psf-model-flux-factor.in       |  9 +++---
 bin/script/psf-model-scattered-light.in   |  9 +++---
 bin/script/radial-profile.in              |  9 +++---
 bin/script/sort-by-night.in               |  9 +++---
 tests/Makefile.am                         | 13 ++++----
 tests/prepconf.sh                         | 32 +++++++++++++++++---
 tests/script/psf-create-junction.sh       | 34 +++++----------------
 tests/script/psf-create-make-stamp.sh     | 41 +++++++------------------
 tests/script/psf-create-select-stars.sh   | 19 +++---------
 tests/script/psf-model-flux-factor.sh     | 40 +++++++------------------
 tests/script/psf-model-scattered-light.sh | 40 +++++++------------------
 tests/script/radial-profile.sh            | 43 +++++++-------------------
 tests/script/sort-by-night.sh             | 20 ++++---------
 18 files changed, 169 insertions(+), 245 deletions(-)

diff --git a/bin/script/ds9-region.in b/bin/script/ds9-region.in
index 1153d3bd..efc739da 100644
--- a/bin/script/ds9-region.in
+++ b/bin/script/ds9-region.in
@@ -131,17 +131,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/fits-view.in b/bin/script/fits-view.in
index b483bc87..63e5df28 100755
--- a/bin/script/fits-view.in
+++ b/bin/script/fits-view.in
@@ -128,17 +128,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/psf-create-junction.in 
b/bin/script/psf-create-junction.in
index d1566576..a34bbbc3 100644
--- a/bin/script/psf-create-junction.in
+++ b/bin/script/psf-create-junction.in
@@ -133,17 +133,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/psf-create-make-stamp.in 
b/bin/script/psf-create-make-stamp.in
index 4c799692..a9b5efbf 100644
--- a/bin/script/psf-create-make-stamp.in
+++ b/bin/script/psf-create-make-stamp.in
@@ -149,17 +149,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
@@ -270,57 +271,68 @@ done
 
 # If an input image is not given at all.
 if [ x"$inputs" = x ]; then
-    echo "$scriptname: no input FITS image files."
-    echo "Run with '--help' for more information on how to run."
+    cat <<EOF
+$scriptname: no input FITS image files. Run with '--help' for more information 
on how to run
+EOF
     exit 1
 elif [ ! -f $inputs ]; then
-    echo "$scriptname: $inputs: No such file or directory."
+    echo "$scriptname: $inputs: No such file or directory"
     exit 1
 fi
 
 # If a stamp width (--stampwidth) is not given at all.
 if [ x"$stampwidth" = x ]; then
-    echo "$scriptname: no stamp width provided."
-    echo "A stamp size (width) has to be specified with --stampwidth or -w."
+    cat <<EOF
+$scriptname: no stamp width provided. A stamp size (width) has to be specified 
with '--stampwidth' (or '-w')
+EOF
     exit 1
 fi
 
 # If center coordinates (--center) is not given at all.
 if [ x"$center" = x ]; then
-    echo "$scriptname: no center coordinates provided."
-    echo "$scriptname: values to '--center' ('-c') should be provided."
+    cat <<EOF
+$scriptname: no center coordinates provided. Please use '--center' ('-c') to 
give the central coordinates
+EOF
     exit 1
 else
     ncenter=$(echo $center | awk 'BEGIN{FS=","}END{print NF}')
     if [ x$ncenter != x2 ]; then
-        echo "$scriptname: '--center' (or '-c') only take two values, but 
$ncenter were given"
+        cat <<EOF
+$scriptname: '--center' (or '-c') only take two values, but $ncenter were 
given in '$center'
+EOF
         exit 1
     fi
 fi
 
 # If a normalization range is not given at all.
 if [ x"$normradii" = x ]; then
-    echo "$scriptname: no ring of normalization provided."
-    echo "$scriptname: the stamp won't be normalized."
+    cat <<EOF
+$scriptname: warning: no ring of normalization provided. the stamp won't be 
normalized
+EOF
 else
     nnormradii=$(echo $normradii | awk 'BEGIN{FS=","}END{print NF}')
     if [ x$nnormradii != x2 ]; then
-        echo "$scriptname: '--normradii' (or '-n') only take two values, but 
$nnormradii were given"
+        cat <<EOF
+$scriptname: '--normradii' (or '-n') only take two values, but $nnormradii 
were given in '$normradii'
+EOF
         exit 1
     fi
 fi
 
 # If mode (--mode) is not given at all.
 if [ x"$mode" = x ]; then
-    echo "$scriptname: no mode provided."
-    echo "$scriptname: value to '--mode' ('-O') should be provided."
+    cat <<EOF
+$scriptname: no coordinate mode provided. The '--mode' ('-O') takes one of the 
following two values: 'img' (for pixel coordinates) or 'wcs' (for celestial 
coordinates)
+EOF
     exit 1
+
 # Make sure the value to '--mode' is either 'wcs' or 'img'.
 elif [ $mode = "wcs" ] || [ $mode = "img" ]; then
     junk=1
 else
-    echo "$scriptname: wrong value to --mode (-O) provided."
-    echo "$scriptname: value to '--mode' ('-O') should be 'wcs' or 'img'"
+    cat <<EOF
+$scriptname: value to '--mode' (or '-O') is not recognized ('$mode'). This 
option takes one of the following two values: 'img' (for pixel coordinates) or 
'wcs' (for celestial coordinates)
+EOF
     exit 1
 fi
 
diff --git a/bin/script/psf-create-select-stars.in 
b/bin/script/psf-create-select-stars.in
index 8121b13e..267afb58 100644
--- a/bin/script/psf-create-select-stars.in
+++ b/bin/script/psf-create-select-stars.in
@@ -153,20 +153,21 @@ EOF
 
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
-   if [ "x$2" = x ]; then
-       echo "$scriptname: '$1' doesn't take any values."
-   else
-       echo "$scriptname: '$1' (or '$2') doesn't take any values."
-   fi
-   exit 1
+    if [ "x$2" = x ]; then
+        echo "$scriptname: '$1' doesn't take any values"
+    else
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
+    fi
+    exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
-   fi
+    fi
 }
 
 
diff --git a/bin/script/psf-model-flux-factor.in 
b/bin/script/psf-model-flux-factor.in
index 7c7cad53..11513a2d 100644
--- a/bin/script/psf-model-flux-factor.in
+++ b/bin/script/psf-model-flux-factor.in
@@ -150,17 +150,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/psf-model-scattered-light.in 
b/bin/script/psf-model-scattered-light.in
index d94bf7a0..fff11b0c 100644
--- a/bin/script/psf-model-scattered-light.in
+++ b/bin/script/psf-model-scattered-light.in
@@ -133,17 +133,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 3430b8bc..7335c7df 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -157,17 +157,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/bin/script/sort-by-night.in b/bin/script/sort-by-night.in
index 78e5c289..fada4f9f 100644
--- a/bin/script/sort-by-night.in
+++ b/bin/script/sort-by-night.in
@@ -135,17 +135,18 @@ EOF
 # Functions to check option values and complain if necessary.
 on_off_option_error() {
     if [ "x$2" = x ]; then
-        echo "$scriptname: '$1' doesn't take any values."
+        echo "$scriptname: '$1' doesn't take any values"
     else
-        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+        echo "$scriptname: '$1' (or '$2') doesn't take any values"
     fi
     exit 1
 }
 
 check_v() {
     if [ x"$2" = x ]; then
-        echo "$scriptname: option '$1' requires an argument."
-        echo "Try '$scriptname --help' for more information."
+        cat <<EOF
+$scriptname: option '$1' requires an argument. Try '$scriptname --help' for 
more information
+EOF
         exit 1;
     fi
 }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ef7392ce..70591a4d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -226,12 +226,13 @@ script/psf-model-scattered-light.sh: mkprof/mosaic2.sh.log
 
 
 # Environment variables for the test scripts.
-AM_TESTS_ENVIRONMENT =                                   \
-export mkdir_p="$(MKDIR_P)";                             \
-export topsrc=$(top_srcdir);                             \
-export topbuild=$(top_builddir);                         \
-export haslibjpeg=$(MAYBE_HASLIBJPEG);                   \
-export hasghostscript=$(MAYBE_HASGHOSTSCRIPT);           \
+AM_TESTS_ENVIRONMENT = \
+export mkdir_p="$(MKDIR_P)"; \
+export progbdir=programs-built; \
+export topsrc=$(abs_top_srcdir); \
+export topbuild=$(abs_top_builddir); \
+export haslibjpeg=$(MAYBE_HASLIBJPEG); \
+export hasghostscript=$(MAYBE_HASGHOSTSCRIPT); \
 export check_with_program=$(MAYBE_CHECK_WITH_PROGRAM);
 
 
diff --git a/tests/prepconf.sh b/tests/prepconf.sh
index fd300ab7..4d66ec97 100755
--- a/tests/prepconf.sh
+++ b/tests/prepconf.sh
@@ -65,21 +65,45 @@ rm addedoptions.txt
 
 
 
-# Bring utility configuration files
+# Necessary files to simplify tests
 # ---------------------------------
 #
 # Each utility's configuration file is copied in the 'tests' directory for
 # easy readability. Note that some programs may need to build their
 # configuration files during compilation. Hence, their configuration files
 # are in the build directory, not the source directory.
-for prog in arithmetic buildprog convertt convolve cosmiccal crop fits    \
-                       match mkcatalog mknoise mkprof noisechisel segment \
-                       statistics table warp
+#
+# To test the 'astscript-*'s, we need to make sure that all the internally
+# built programs are used, not the (possibly existing) host operating
+# system's programs. Since each program is built within its own directory
+# of 'bin', instead of adding all those to the PATH, we will simply put a
+# symbolic link to the program in a special directory.
+if ! [ -d $progbdir ]; then mkdir $progbdir; fi
+for prog in arithmetic buildprog convertt convolve cosmiccal crop \
+            fits match mkcatalog mknoise mkprof noisechisel segment \
+            statistics table warp
 do
+    # Get the configuration file.
     if test -f $topsrc/bin/$prog/ast$prog.conf; then
         ctopdir=$topsrc
     else
         ctopdir=$topbuild
     fi
     cp $ctopdir/bin/$prog/*.conf .gnuastro/
+
+    # If the program was built, put a symbolic link to it:
+    if [ -f $topbuild/bin/$prog/ast$prog ]; then
+        ln -sf $topbuild/bin/$prog/ast$prog $progbdir/
+    fi
+done
+
+
+
+
+
+# Extract all the executable files in the build directory for 'astscripts'
+# and put a link to them in the temporary directory for all Gnuastro
+# executables. This is because some 'astscript-*'s depend on others.
+for f in $(find $topbuild/bin/script/ -type f -perm /111); do
+    ln -sf $f $progbdir/
 done
diff --git a/tests/script/psf-create-junction.sh 
b/tests/script/psf-create-junction.sh
index 19ce0e4e..ebcab291 100755
--- a/tests/script/psf-create-junction.sh
+++ b/tests/script/psf-create-junction.sh
@@ -25,18 +25,14 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=psf-create-junction
-dep1=crop
-dep2=fits
-dep3=warp
-dep4=mkprof
-dep5=arithmetic
-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
 execname=../bin/script/astscript-$prog
+
 fits1name=0_mkprofcat2.fits
+dep1name=$progbdir/astcrop
+dep2name=$progbdir/astfits
+dep3name=$progbdir/astwarp
+dep4name=$progbdir/astmkprof
+dep5name=$progbdir/astarithmetic
 
 
 
@@ -63,19 +59,6 @@ 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
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -85,7 +68,6 @@ ln -sf $dep5name ast$dep5
 #
 # 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"
+export PATH="$progbdir:$PATH"
 $check_with_program $execname $fits1name --core=$fits1name \
-                                         --fluxfactor=3.3 --radius=5
-
+                              --fluxfactor=3.3 --radius=5
diff --git a/tests/script/psf-create-make-stamp.sh 
b/tests/script/psf-create-make-stamp.sh
index 2a837bfa..a46deff2 100755
--- a/tests/script/psf-create-make-stamp.sh
+++ b/tests/script/psf-create-make-stamp.sh
@@ -25,21 +25,17 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=psf-create-make-stamp
-dep1=crop
-dep2=fits
-dep3=table
-dep4=arithmetic
-dep5=statistics
-dep6=radial-profile
-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/script/astscript-$dep6
 execname=../bin/script/astscript-$prog
+
 fits1name=0_mkprofcat2.fits
 
+dep1name=$progbdir/astcrop
+dep2name=$progbdir/astfits
+dep3name=$progbdir/asttable
+dep4name=$progbdir/astarithmetic
+dep5name=$progbdir/aststatistics
+dep6name=$progbdir/astscript-radial-profile
+
 
 
 
@@ -66,20 +62,6 @@ 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 astscript-$dep6
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -89,8 +71,7 @@ ln -sf $dep6name astscript-$dep6
 #
 # 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"
-y=$($dep2name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
-x=$($dep2name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+export PATH="$progbdir:$PATH"
+x=$($dep2name $fits1name -h1 | awk '/^NAXIS1/{print $3/2}')
+y=$($dep2name $fits1name -h1 | awk '/^NAXIS2/{print $3/2}')
 $check_with_program $execname $fits1name --center=$x,$y --mode=img 
--stampwidth=100,100
-
diff --git a/tests/script/psf-create-select-stars.sh 
b/tests/script/psf-create-select-stars.sh
index 6b8f26f6..bdfb1163 100755
--- a/tests/script/psf-create-select-stars.sh
+++ b/tests/script/psf-create-select-stars.sh
@@ -25,11 +25,10 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=psf-create-select-stars
-dep1=mkcatalog
-dep2=match
-dep1name=../bin/$dep1/ast$dep1
-dep2name=../bin/$dep2/ast$dep2
 execname=../bin/script/astscript-$prog
+
+dep1name=$progbdir/astmatch
+dep2name=$progbdir/astmkcatalog
 fits1name=convolve_spatial_noised.fits
 fits2name=convolve_spatial_noised_detected_segmented.fits
 fits3name=convolve_spatial_noised_detected_segmented_catalog.fits
@@ -57,16 +56,6 @@ if [ ! -f $fits2name ]; then echo "$fits2name 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
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -76,7 +65,7 @@ ln -sf $dep2name ast$dep2
 #
 # 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"
+export PATH="$progbdir:$PATH"
 
 # Create a catalog with appropiate parameters
 $check_with_program astmkcatalog $fits2name \
diff --git a/tests/script/psf-model-flux-factor.sh 
b/tests/script/psf-model-flux-factor.sh
index 3c98d02d..d83ace2c 100755
--- a/tests/script/psf-model-flux-factor.sh
+++ b/tests/script/psf-model-flux-factor.sh
@@ -25,20 +25,15 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=psf-model-flux-factor
-dep1=fits
-dep2=crop
-dep3=table
-dep4=arithmetic
-dep5=statistics
-dep6=radial-profile
-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/script/astscript-$dep6
 execname=../bin/script/astscript-$prog
+
 fits1name=mkprofcat1.fits
+dep1name=$progbdir/astfits
+dep2name=$progbdir/astcrop
+dep3name=$progbdir/asttable
+dep4name=$progbdir/astarithmetic
+dep5name=$progbdir/aststatistics
+dep6name=$progbdir/astscript-radial-profile
 
 
 
@@ -66,20 +61,6 @@ 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 astscript-$dep6
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -89,10 +70,9 @@ ln -sf $dep6name astscript-$dep6
 #
 # 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"
-y=$($dep1name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
-x=$($dep1name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+export PATH="$progbdir:$PATH"
+x=$($dep1name $fits1name -h1 | awk '/^NAXIS1/{print $3/2}')
+y=$($dep1name $fits1name -h1 | awk '/^NAXIS2/{print $3/2}')
 $check_with_program $execname $fits1name --center=$x,$y --mode=img \
                                          --psf=$fits1name \
                                          --normradii=5,10
-
diff --git a/tests/script/psf-model-scattered-light.sh 
b/tests/script/psf-model-scattered-light.sh
index 28aa9273..34d7b4e8 100755
--- a/tests/script/psf-model-scattered-light.sh
+++ b/tests/script/psf-model-scattered-light.sh
@@ -25,20 +25,15 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=psf-model-scattered-light
-dep1=fits
-dep2=crop
-dep3=table
-dep4=arithmetic
-dep5=statistics
-dep6=radial-profile
-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/script/astscript-$dep6
 execname=../bin/script/astscript-$prog
+
 fits1name=mkprofcat1.fits
+dep1name=$progbdir/astfits
+dep2name=$progbdir/astcrop
+dep3name=$progbdir/asttable
+dep4name=$progbdir/astarithmetic
+dep5name=$progbdir/aststatistics
+dep6name=$progbdir/astscript-radial-profile
 
 
 
@@ -66,20 +61,6 @@ 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 astscript-$dep6
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -89,9 +70,8 @@ ln -sf $dep6name astscript-$dep6
 #
 # 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"
-y=$($dep1name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
-x=$($dep1name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+export PATH="$progbdir:$PATH"
+x=$($dep1name $fits1name -h1 | awk '/^NAXIS1/{print $3/2}')
+y=$($dep1name $fits1name -h1 | awk '/^NAXIS2/{print $3/2}')
 $check_with_program $execname $fits1name --center=$x,$y --mode=img \
                                          --psf=$fits1name --fluxfactor=3.3
-
diff --git a/tests/script/radial-profile.sh b/tests/script/radial-profile.sh
index b753fb84..db6e5c98 100755
--- a/tests/script/radial-profile.sh
+++ b/tests/script/radial-profile.sh
@@ -25,24 +25,17 @@
 # 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
+
+dep1name=$progbdir/astfits
+dep2name=$progbdir/astcrop
+dep3name=$progbdir/astwarp
+dep4name=$progbdir/asttable
 fits1name=0_mkprofcat2.fits
+dep5name=$progbdir/astmkprof
+dep6name=$progbdir/astmkcatalog
+dep7name=$progbdir/astarithmetic
+dep8name=$progbdir/aststatistics
 
 
 
@@ -72,22 +65,6 @@ 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
 # ==================
 #
@@ -97,5 +74,5 @@ ln -sf $dep8name ast$dep8
 #
 # 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"
+export PATH="$progbdir:$PATH"
 $check_with_program $execname $fits1name
diff --git a/tests/script/sort-by-night.sh b/tests/script/sort-by-night.sh
index 2f6b292a..baaee81c 100755
--- a/tests/script/sort-by-night.sh
+++ b/tests/script/sort-by-night.sh
@@ -24,11 +24,11 @@
 # basic checks to see if the executable is made or if the defaults
 # file exists (basicchecks.sh is in the source tree).
 prog=sort-by-night
-dep1=fits
-dep2=table
-dep1name=../bin/$dep1/ast$dep1
-dep2name=../bin/$dep2/ast$dep2
 execname=../bin/script/astscript-$prog
+
+dep1name=$progbdir/astfits
+dep2name=$progbdir/asttable
+
 fits1name=clearcanvas.fits
 fits2name=aperturephot.fits
 fits3name=convolve_spatial.fits
@@ -61,16 +61,6 @@ if [ ! -f $fits5name ]; 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
-ln -sf $dep2name ast$dep2
-
-
-
-
-
 # Actual test script
 # ==================
 #
@@ -80,6 +70,6 @@ ln -sf $dep2name ast$dep2
 #
 # 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"
+export PATH="$progbdir:$PATH"
 $check_with_program $execname $fits1name $fits2name $fits3name \
                     $fits4name $fits5name



reply via email to

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