new commands testsuite and testcase

This commit is contained in:
Marc Wäckerlin
2015-05-09 12:27:03 +00:00
parent ee1ebd8ca9
commit 9335d5f6bb
8 changed files with 329 additions and 105 deletions

View File

@@ -22,28 +22,31 @@ configure=0
build=0
overwrite=0
rebuild=0
rebuildfiles=()
while test $# -gt 0; do
case "$1" in
(--configure|-c) configure=1;;
(--build|-b) configure=1; build=1;;
(--overwrite|-o) overwrite=1;;
(--rebuild|-r) rebuild=1;;
(--rebuild-file|-f) shift; rebuildfiles+=("$1");;
(--version|-v)
echo "$Id$";
exit;;
(--help|-h) less <<EOF
SYNOPSIS
${MY_NAME} [--help|-h] [--configure|-c]
${MY_NAME} [--help|-h] [OPTIOS]
OPTIONS
--configure, -c call ./configure after initialization
--build, -c build, call ./configure && make after initialization
--overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
--rebuild -r force rebuild of generated files, even if modified
--help, -h show this help
--version, -v show version and date of this file
--configure, -c call ./configure after initialization
--build, -c build, also call ./configure && make
--overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
--rebuild, -r force rebuild of generated files, even if modified
--rebuild-file, -f <file> rebild specific file (can be added multiple times)
--help, -h show this help
--version, -v show version and date of this file
DESCRIPTION
@@ -122,9 +125,15 @@ GENERATED FILES
REBUILDING FILES
To rebuild all these files, just run "${MY_NAME} -o". You can also
remove and rebuild a single file by removing it from subversion,
just call "svn rm <file>" and "${MY_NAME}" to rebuild file "<file>".
To rebuild all these files, just run "${MY_NAME} -r".
To copy only the files provided by this package, that means those
files you must never change, that means to update the build system
to the latest release, run "${MY_NAME} -o"
You can also rebuild a list of singleany list of specific file files
by adding option "${MY_NAME} -f <file>" to rebuild file
"<file>". You can add option "-f" more than once.
FILES TO EDIT
@@ -216,7 +225,7 @@ done
HEADER='## @id '"\$Id\$"'
#
# This file has been added by '${MY_NAME}' on '$(date +"%Y-%m-%d %H:%M %Z")'
# This file has been added by '${MY_NAME}' on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")'
# Feel free to change it or even remove and rebuild it, up to your needs
#
## 1 2 3 4 5 6 7 8
@@ -224,6 +233,10 @@ HEADER='## @id '"\$Id\$"'
'
notice() {
echo -e "\e[1;33m$*\e[0m"
}
run() {
check=1
while test $# -gt 0; do
@@ -256,6 +269,12 @@ testtag() {
egrep -q '^ *'"$1" configure.ac
}
contains() {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
checkdir() {
if ! test -d "$1"; then # create path
run mkdir -p "$1"
@@ -285,8 +304,10 @@ to() {
esac
shift;
done
if checkfile "$1" && test $rebuild -eq 0; then # file already exists
return
if checkfile "$1" && test $rebuild -eq 0 \
&& ! contains "$1" "${rebuildfiles[@]}"; then
# file already exists and must not be rebuilt
return 1
fi
checkdir "$(dirname ${1})"
echo -en "\e[1m-> generating:\e[0m $1 ..."
@@ -307,10 +328,13 @@ to() {
run svn add "$1"
run svn propset svn:keywords "Id" "$1"
fi
return 0
}
copy() {
if checkfile "$1" && test $overwrite -eq 0; then
if checkfile "$1" && test $overwrite -eq 0 \
&& ! contains "$1" "${rebuildfiles[@]}"; then
# file already exists and must not be rebuilt
return
fi
run cp "${0%/*}/$1" "$1"
@@ -347,14 +371,18 @@ copy ${MY_NAME}
copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4
copy AUTHORS
if ! test -f configure.ac; then
to configure.ac <<EOF
AUTHOR=$(gpg -K | sed -n 's,uid *,,p' | sort | head -1)
if test -z "${AUTHOR}"; then
AUTHOR="FIRSTNAME LASTNAME (URL) <EMAIL>"
fi
echo "$AUTHOR" | to AUTHORS && notice "please edit AUTHORS"
to configure.ac <<EOF && \
( notice "please edit configure.ac, then rerun $0"; exit 0 )
${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
m4_define(x_major, 0) # project's major version
m4_define(x_minor, 0) # project's minor version
m4_include(ax_init_standard_project.m4)
AC_INIT(x_package_name, x_major.x_minor.x_least, x_bugreport, x_package_name)
AC_INIT(x_package_name, x_version, x_package_name)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AX_INIT_STANDARD_PROJECT
@@ -370,14 +398,11 @@ AX_INIT_STANDARD_PROJECT
# qt features, uncomment, what you need:
#AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
#AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_KEYWORDS"
#AX_QT_NO_KEYWORDS
# create output
AC_OUTPUT
EOF
echo "please edit configure.ac, then rerun $0"
exit 0
fi
PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac)
echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_CXX src/makefile.am
to --condition AX_USE_CXX src/version.hxx <<EOF
@@ -473,10 +498,14 @@ LDADD = -l${PACKAGE_NAME}
MAINTAINERCLEANFILES = makefile.in
EOF
if testtag AX_USE_DOXYGEN && ! test -f doc/doxyfile.in; then
if testtag AX_USE_DOXYGEN && \
( ! checkfile doc/doxyfile.in || \
contains doc/doxyfile.in "${rebuildfiles[@]}" ); then
run doxygen -g doc/doxyfile.in
run svn add doc/doxyfile.in
run svn propset svn:keywords "Id" doc/doxyfile.in
if test $exists -eq 0; then
run svn add doc/doxyfile.in
run svn propset svn:keywords "Id" doc/doxyfile.in
fi
doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
@@ -595,13 +624,15 @@ ${HEADER}%:
EOF
echo 7 | to debian/compat
fi
if ! test -f makefile.am; then
SUBDIRS=""
for d in src test scripts doc examples; do
test -d $d && SUBDIRS="${SUBDIRS} $d"
done
echo "${HEADER}SUBDIRS =${SUBDIRS}\n\nMAINTAINERCLEANFILES = makefile.in" | to makefile.am
fi
SUBDIRS=""
for d in src test scripts doc examples; do
test -d $d && SUBDIRS="${SUBDIRS} $d"
done
to makefile.am<<EOF
${HEADER}SUBDIRS =${SUBDIRS}
MAINTAINERCLEANFILES = makefile.in
EOF
to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF
${HEADER}prefix=@prefix@
exec_prefix=@exec_prefix@
@@ -613,6 +644,7 @@ Description: @DESCRIPTION@
Version: @VERSION@
Libs: -L\${libdir} -l@PACKAGE_NAME@ @LDFLAGS@
Cflags: -I\${includedir} @CPPFLAGS@
Requires: @PKG_REQUIREMENTS@
EOF
#### Cleanup If Makefile Exists ####