aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/create-test.sh
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /searchlib/src/tests/create-test.sh
Publish
Diffstat (limited to 'searchlib/src/tests/create-test.sh')
-rwxr-xr-xsearchlib/src/tests/create-test.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/searchlib/src/tests/create-test.sh b/searchlib/src/tests/create-test.sh
new file mode 100755
index 00000000000..d2bc3ded67b
--- /dev/null
+++ b/searchlib/src/tests/create-test.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+gen_project_file() {
+ echo "generating '$1' ..."
+ echo "APPLICATION ${test}_test" > $1
+ echo "OBJS ${test}_test" >> $1
+ echo "LIBS searchlib/searchlib" >> $1
+ echo "EXTERNALLIBS searchcommon persistencetypes metrics" >> $1
+ echo "" >> $1
+ echo "CUSTOMMAKE" >> $1
+ echo "test: all" >> $1
+ echo -e "\t\$(HIDE) \$(LDL) \$(VALGRIND) ./${test}_test" >> $1
+}
+
+gen_source() {
+ echo "generating '$1' ..."
+ echo "#include <vespa/vespalib/testkit/test_kit.h>" >> $1
+ echo "" >> $1
+ echo "// using namespace search;" >> $1
+ echo "" >> $1
+ echo "TEST(\"require something\") {" >> $1
+ echo "}" >> $1
+ echo "" >> $1
+ echo "TEST_MAIN() { TEST_RUN_ALL(); }" >> $1
+}
+
+gen_file_list() {
+ echo "generating '$1' ..."
+ echo "${test}_test.cpp" > $1
+}
+
+if [ $# -ne 1 ]; then
+ echo "usage: $0 <name>"
+ echo " name: name of the test to create"
+ exit 1
+fi
+
+test=$1
+if [ -e $test ]; then
+ echo "$test already present, don't want to mess it up..."
+ exit 1
+fi
+
+echo "creating directory '$test' ..."
+mkdir -p $test || exit 1
+cd $test || exit 1
+test=`basename $test`
+
+gen_project_file fastos.project
+gen_source ${test}_test.cpp
+gen_file_list FILES