gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master cb7d44a 2/2: Script to rebuild for tests durin


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master cb7d44a 2/2: Script to rebuild for tests during development
Date: Wed, 10 Aug 2016 21:18:04 +0000 (UTC)

branch: master
commit cb7d44a92f25b92a4fcf82a156ec8c88617699a3
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Script to rebuild for tests during development
    
    During development, you often need to recompile the program and test your
    work/changes in the code. With this script the process becomes really
    easy. Especially when it is used in conjunction with the
    `tmpfs-config-make' script of the top source directory. Just set the values
    of the necessary variables in this script, then simply call it everytime
    you want to re-build Gnuastro and test the changes you have made.
    
    The comments at the start of the script thoroughly explain what it does. It
    is just important for developers to remember that after their work is done
    and they want to commit, they run first run the following command to reset
    this file to its original status and not mistakenly commit their temporary
    changes to this file.
    
       git checkout -- tests/during-dev.sh
---
 Makefile.am         |    3 +-
 tests/during-dev.sh |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index aeab85b..5a7cf75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,7 +117,8 @@ EXTRA_DIST = bootstrap bootstrap.conf genauthors 
.dir-locals.el .version   \
              tmpfs-config-make bootstrapped/m4/gnulib-cache.m4             \
              bootstrapped/README .autom4te.cfg lib/gnuastro/commonargs.h   \
              lib/gnuastro/commonparams.h lib/gnuastro/fixedstringmacros.h  \
-             lib/gnuastro/neighbors.h lib/gnuastro/README
+             lib/gnuastro/neighbors.h lib/gnuastro/README                  \
+             tests/during-dev.sh
 
 
 
diff --git a/tests/during-dev.sh b/tests/during-dev.sh
new file mode 100755
index 0000000..2dc4935
--- /dev/null
+++ b/tests/during-dev.sh
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Script to rebuild and test a utility during development.
+#
+# During the development of Gnuastro, you often make changes in a utility
+# then need to rebuild and run it with special arguments and options (to
+# test your work). This script is made to facilitate this process. It will
+# take these steps:
+#
+#   1. Delete an existing utility executable.
+#
+#   2. Run Make on all Gnuastro.
+#
+#   3. If Make was successful, then go into the output directory, and run
+#      utility with the given arguments and options. The executable is run
+#      within an output directory (possibly different from the source or
+#      build directories) so if you need to make lots of temporary test
+#      files, there they won't get mixed up with non-output files.
+#
+# Combined with the `tmpfs-config-make', this script can be used to greatly
+# simplify the development process. After running that script once, for
+# subsequent builds during your development, you can run this script from
+# the top source directory (by running `./tests/during-dev.sh', or giving
+# this to the `compile' command in Emacs). Note that you have to set the
+# first few variables (directories, utility name, arguments and options)
+# manually before each major development activity.
+#
+# This file will be changed alot during development. So please make sure
+# you have left the variable values empty before making commit so each
+# developer is guided to set them for their own case. Alternatively you can
+# reset this file to its version controlled status before making your
+# commit:
+#
+#     git checkout -- tests/during-dev.sh
+#
+# Original author:
+#     Mohammad Akhlaghi <address@hidden>
+# Contributing author(s):
+# Copyright (C) 2016, Free Software Foundation, Inc.
+#
+# Gnuastro is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Gnuastro is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+
+# SET INPUT PARAMETERS
+# ====================
+
+# Set the basic test directories. If you are building over the source
+# directory, then set `builddir' to `./'. If you want the outputs to be in
+# the top source directory, set it to `./'. Since 'build' is the assumed
+# symbolic link in `tmpfs-config-make', it is also assumed in the version
+# controlled version of this script.
+builddir=build
+outdir=
+
+
+# Set the utility name, along with its arguments and options.
+utilname=
+arguments=
+options=
+
+
+
+
+
+# RUN THE PROCEDURES
+# ==================
+
+# First, make sure the variables are set. Note that arguments and options
+# are not absolutly vital! so they are not checked here. The utility will
+# warn and halt if it needs them.
+if [ x$outdir = x ];   then echo "outdir is not set.";   exit 1; fi
+if [ x$builddir = x ]; then echo "builddir is not set."; exit 1; fi
+if [ x$utilname = x ]; then echo "utilname is not set."; exit 1; fi
+
+
+# If builddir is relative, then append the current directory to make it
+# absolute. This is done because we will be going into the output directory
+# for executing the utility and we need to know the absolute address of the
+# top build directory.
+if [ ! "${builddir:0:1}" = "/" ]; then
+   builddir=$(pwd)/$builddir
+fi
+
+
+# Set the utility's executable file name
+utility=$builddir/src/$utilname/ast$utilname
+
+
+# If the utility is already built, then remove the executable.
+if [ -f $utility ]; then rm $utility; fi
+
+
+# Make Gnuastro (note that during development, it is sometimes necessary to
+# edit/rebuild the libraries too). If Make is successful, then change to
+# the output directory and run the utility with the given arguments and
+# options.
+curdir=$(pwd)
+if make -C $builddir; then
+    cd $outdir
+    $utility $arguments $options
+fi



reply via email to

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