[tracker] Functional tests: duplicate code is evil
- From: Ivan Frade <ifrade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Functional tests: duplicate code is evil
- Date: Mon, 10 May 2010 13:26:04 +0000 (UTC)
commit 9f8bea0f80ee22cfb03f108c7cbab1d85e702ffd
Author: Ivan Frade <ivan frade nokia com>
Date: Mon May 10 16:24:23 2010 +0300
Functional tests: duplicate code is evil
.../functional-tests/force-sqlite-misused-batch.sh | 26 +------------------
tests/functional-tests/force-sqlite-misused.sh | 26 +------------------
tests/functional-tests/helper-test-data.sh | 27 ++++++++++++++++++++
3 files changed, 29 insertions(+), 50 deletions(-)
---
diff --git a/tests/functional-tests/force-sqlite-misused-batch.sh b/tests/functional-tests/force-sqlite-misused-batch.sh
index 56d002d..b0f2a93 100755
--- a/tests/functional-tests/force-sqlite-misused-batch.sh
+++ b/tests/functional-tests/force-sqlite-misused-batch.sh
@@ -1,30 +1,6 @@
#!/bin/bash
-if [[ ! -e ../../utils/data-generators/cc/generate ]]; then
- echo "Run this from test/functional-tests/"
- exit 2
-fi
-
-# If we don't have ttl files, bring them from the data-generators
-if [[ ! -d ttl ]]; then
- CURRENT=`pwd`
- cd ../../utils/data-generators/cc
- # Generation takes time. Don't ask if they are already generated.
- # Checking just one random .ttl file... not good
- if [[ ! -e ttl/032-nmo_Email.ttl ]]; then
- ./generate max.cfg ;
- else
- echo "TTL directory already exist"
- fi
- cd $CURRENT
- echo "Moving ttl generated files to functional-tests folder"
- cp -R ../../utils/data-generators/cc/ttl . || (echo "Error generating ttl files" && exit 3)
-else
- echo "TTL files already in place"
-fi
-
-echo "Cleaning tracker DBs and restarting"
-tracker-control -rs
+source helper-test-data.sh
echo "Ready, now running the test"
python2.5 11-sqlite-batch-misused.py
diff --git a/tests/functional-tests/force-sqlite-misused.sh b/tests/functional-tests/force-sqlite-misused.sh
index fdc1af9..853a608 100755
--- a/tests/functional-tests/force-sqlite-misused.sh
+++ b/tests/functional-tests/force-sqlite-misused.sh
@@ -1,30 +1,6 @@
#!/bin/bash
-if [[ ! -e ../../utils/data-generators/cc/generate ]]; then
- echo "Run this from test/functional-tests/"
- exit 2
-fi
-
-# If we don't have ttl files, bring them from the data-generators
-if [[ ! -d ttl ]]; then
- CURRENT=`pwd`
- cd ../../utils/data-generators/cc
- # Generation takes time. Don't ask if they are already generated.
- # Checking just one random .ttl file... not good
- if [[ ! -e ttl/032-nmo_Email.ttl ]]; then
- ./generate max.cfg ;
- else
- echo "TTL directory already exist"
- fi
- cd $CURRENT
- echo "Moving ttl generated files to functional-tests folder"
- cp -R ../../utils/data-generators/cc/ttl . || (echo "Error generating ttl files" && exit 3)
-else
- echo "TTL files already in place"
-fi
-
-echo "Cleaning tracker DBs and restarting"
-tracker-control -rs
+source helper-test-data.sh
echo "Ready, now running the test"
python2.5 10-sqlite-misused.py
diff --git a/tests/functional-tests/helper-test-data.sh b/tests/functional-tests/helper-test-data.sh
new file mode 100644
index 0000000..cf0015e
--- /dev/null
+++ b/tests/functional-tests/helper-test-data.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+if [[ ! -e ../../utils/data-generators/cc/generate ]]; then
+ echo "Run this from test/functional-tests/"
+ exit 2
+fi
+
+# If we don't have ttl files, bring them from the data-generators
+if [[ ! -d ttl ]]; then
+ CURRENT=`pwd`
+ cd ../../utils/data-generators/cc
+ # Generation takes time. Don't ask if they are already generated.
+ # Checking just one random .ttl file... not good
+ if [[ ! -e ttl/032-nmo_Email.ttl ]]; then
+ ./generate max.cfg ;
+ else
+ echo "TTL directory already exist"
+ fi
+ cd $CURRENT
+ echo "Moving ttl generated files to functional-tests folder"
+ cp -R ../../utils/data-generators/cc/ttl . || (echo "Error generating ttl files" && exit 3)
+else
+ echo "TTL files already in place"
+fi
+
+echo "Cleaning tracker DBs and restarting"
+tracker-control -rs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]