summaryrefslogtreecommitdiff
path: root/rtems-test-template
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-01-14 02:30:14 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-01-14 02:30:14 -0600
commit3f621085163cf2f3bb5bf6d0602b5f3fc6f7f4fd (patch)
treecf1ff615cf0999325ac87469a40227211fc81a49 /rtems-test-template
parente6a5d7715e71d896ec389867f14829f3fb832429 (diff)
Distribute cvs-helpers to other directories.
Diffstat (limited to 'rtems-test-template')
-rw-r--r--rtems-test-template/Makefile20
-rwxr-xr-xrtems-test-template/mktest133
2 files changed, 153 insertions, 0 deletions
diff --git a/rtems-test-template/Makefile b/rtems-test-template/Makefile
new file mode 100644
index 0000000..6afcd0a
--- /dev/null
+++ b/rtems-test-template/Makefile
@@ -0,0 +1,20 @@
+#
+# $Id: Makefile,v 1.3 2010/06/21 12:37:03 joel Exp $
+#
+
+INSTALL_DIR=../bin
+SCRIPTS=commit-with-changelog-diff commit mkChangeLogList prepend mktest
+
+all: prep ${SCRIPTS} install
+
+prep:
+ test -d ${INSTALL_DIR} || mkdir ${INSTALL_DIR}
+
+clean:
+
+install:
+ for i in ${SCRIPTS} ; do \
+ cp $${i} ${INSTALL_DIR}/$${i} ; \
+ chmod +x ${INSTALL_DIR}/$${i} ; \
+ done
+
diff --git a/rtems-test-template/mktest b/rtems-test-template/mktest
new file mode 100755
index 0000000..e837fd0
--- /dev/null
+++ b/rtems-test-template/mktest
@@ -0,0 +1,133 @@
+#! /bin/sh
+#
+# Process a test template directory into the baseline for a new test
+#
+# $Id$
+#
+
+toggle()
+{
+ case $1 in
+ no) echo "yes" ;;
+ yes) echo "no" ;;
+ *) fatal "Unknown value to toggle ($1)" ;;
+ esac
+}
+
+check_status()
+{
+ if [ $1 -ne 0 ] ; then
+ shift
+ echo "FAILED: " "$*" >&2
+ exit 1
+ fi
+}
+
+usage()
+{
+ echo "$progname -s SOURCE -d DEST -D description -n NUMBER [-v]"
+ echo " OR"
+ echo "$progname -c -d DEST"
+cat <<EOF
+
+The first form is to generate a new test.
+The second form is to add the new test to CVS.
+EOF
+ exit 1
+}
+
+addToCVS=no
+source=
+dest=
+desc=
+testNum=
+verbose=no
+while getopts cd:D:s:n:v OPT
+do
+ case "$OPT" in
+ c) addToCVS=`toggle ${addToCVS}` ;;
+ d) dest=$OPTARG ;;
+ D) desc=$OPTARG ;;
+ s) source=$OPTARG ;;
+ n) testNum=$OPTARG ;;
+ v) verbose=`toggle ${verbose}` ;;
+ *) usage ;;
+ esac
+done
+
+# Error check
+test "X${dest}" != "X"
+check_status $? No destination provided
+test -r configure.ac
+check_status $? Not in test suite directory
+
+
+if [ ${addToCVS} == yes ] ; then
+ test -d ${dest}
+ check_status $? "Cannot add ${dest} -- does not exist"
+
+ cvs add ${dest}
+ cd ${dest}
+ for f in `ls -1 .cvsignore Makefile.am *.doc *.scn *.[ch] 2>/dev/null`
+ do
+ cvs add -kkv ${f}
+ done
+ exit 0
+fi
+
+test "X${source}" != "X"
+check_status $? No source provided
+test -d "${source}"
+check_status $? Source directory not present
+test "X${testNum}" != "X"
+check_status $? No test number provided
+
+test ! -d ${dest}/CVS
+check_status $? "Are you sure about ${dest}? Already a CVS directory in it"
+
+let $((shiftcount = $OPTIND - 1))
+shift #shiftcount
+
+args=$*
+
+destCaps=`echo ${dest} | tr [:lower:] [:upper:]`
+echo ${destCaps}
+
+# Process the test
+rm -rf ${dest}
+check_status $? "Unable to remove ${dest}"
+
+mkdir ${dest}
+check_status $? "Unable to make ${dest}"
+
+# all the source code we know about
+for s in ${source}/*
+do
+ if [ -r ${s} -a ! -d ${s} ] ; then
+ b=`basename ${s}`
+ d=`echo ${dest}/${b} | sed "s/TEST\./${dest}\./"`
+ echo Processing ${s} to ${d}
+ sed -e "s/@LOWER@/${dest}/g" \
+ -e "s/@UPPER@/${destCaps}/g" \
+ -e "s/@DESC@/${desc}/g" \
+ -e "s/@TESTNUM@/${testNum}/g" \
+ <${s} >${d}
+ check_status $? "Unable to process ${d}"
+ fi
+done
+
+cat <<EOF >${dest}/.cvsignore
+Makefile
+Makefile.in
+EOF
+
+cat <<EOF
+You need to add the test to the Makefile.am and configure.ac by hand
+before you can build.
+
+You will have to add content to the test itself including screen
+and doc files.
+
+EOF
+
+exit 0