[emt] r223 committed - This mainly fixes an issue with the test framework. test.sh was checki...

5 views
Skip to first unread message

e...@googlecode.com

unread,
Jan 9, 2012, 11:49:40 PM1/9/12
to emt...@googlegroups.com
Revision: 223
Author: eric.bergen
Date: Mon Jan 9 20:49:04 2012
Log: This mainly fixes an issue with the test framework. test.sh was
checking for the return of code == 1 to indicate and error instead of != 0.
diff can return other codes so the test was saying success when it should
have failed. At some point I added precision and instances into the tests.
These weren't correctly recorded in the golden files because the test was
saying it passed when it really didn't. I've both fixed the test and
cleaned up the golden files so they match the correct results.

I've also moved the sqlite3.dat file created during the test into tmp/. The
file has a timestamp in it which made the tests always fail because the
golden file timestamp was always older than the current run. I need to come
up with a test that strips the timestamp and diffs it similar to the
localtext test. The current test still exercises sqlite but the timestamps
from emt_view are changed before being compared against the golden files.

http://code.google.com/p/emt/source/detail?r=223

Deleted:
/trunk/test/golden/sqlite3.dat
Modified:
/trunk/plugins/fields/test.php
/trunk/test/etc/emt.cnf
/trunk/test/etc/emt_sqlite_input.cnf
/trunk/test/golden/emt_view
/trunk/test/golden/emt_view.sqlite
/trunk/test/golden/emt_view_multiple
/trunk/test/golden/emt_view_multiple.sqlite
/trunk/test/golden/gather
/trunk/test/test.sh

=======================================
--- /trunk/test/golden/sqlite3.dat Fri Feb 11 09:39:21 2011
+++ /dev/null
Binary file, no diff available.
=======================================
--- /trunk/plugins/fields/test.php Fri Feb 11 09:39:21 2011
+++ /trunk/plugins/fields/test.php Mon Jan 9 20:49:04 2012
@@ -37,7 +37,7 @@
var $namespace = 'test';
var $name = 'test_multiple';
var $fname = 'Test Multiple';
- var $description = 'This is a multie value field';
+ var $description = 'This is a multi value field';
var $type = 'incr';
var $precision = 1;
var $command = 'test_command';
=======================================
--- /trunk/test/etc/emt.cnf Fri Feb 11 09:39:21 2011
+++ /trunk/test/etc/emt.cnf Mon Jan 9 20:49:04 2012
@@ -20,7 +20,7 @@
output_file=./run/gather

[sqlite3]
-data_file=./run/sqlite3.dat
+data_file=./tmp/sqlite3.dat

[emt_view]
default_view = default
=======================================
--- /trunk/test/etc/emt_sqlite_input.cnf Fri Feb 11 09:39:21 2011
+++ /trunk/test/etc/emt_sqlite_input.cnf Mon Jan 9 20:49:04 2012
@@ -4,4 +4,4 @@
input_handler=sqlite3

[sqlite3]
-data_file=./run/sqlite3.dat
+data_file=./tmp/sqlite3.dat
=======================================
--- /trunk/test/golden/emt_view Mon Aug 16 21:49:09 2010
+++ /trunk/test/golden/emt_view Mon Jan 9 20:49:04 2012
@@ -1,5 +1,5 @@
-[-------emt-------]
[-------------------------------------test------------------------------------]
-[-----------------] [---------------inst_one--------------]
[---------------inst_two--------------]
-Sampling Start Time [------Test Multiple------] Test Single [------Test
Multiple------] Test Single
- bar foo bar
foo
-2010-06-25 15:09:06 3 2 1 13
12 11
+[-------emt-------]
[---------------------------------------------------test--------------------------------------------------]
+[-----------------] [----------------------inst_one---------------------]
[----------------------inst_two---------------------]
+Sampling Start Time [-------------Test Multiple-------------] Test Single
[-------------Test Multiple-------------] Test Single
+ bar dm-1 foo
bar dm-1 foo
+2010-06-25 15:09:06 4 3.3 2.2 1
14 13.3 12.2 11
=======================================
--- /trunk/test/golden/emt_view.sqlite Fri Feb 11 09:39:21 2011
+++ /trunk/test/golden/emt_view.sqlite Mon Jan 9 20:49:04 2012
@@ -1,5 +1,5 @@
-[-------emt-------]
[-------------------------------------test------------------------------------]
-[-----------------] [---------------inst_one--------------]
[---------------inst_two--------------]
-Sampling Start Time [------Test Multiple------] Test Single [------Test
Multiple------] Test Single
- bar foo bar
foo
-2010-06-25 15:09:06 3 2 1 13
12 11
+[-------emt-------]
[---------------------------------------------------test--------------------------------------------------]
+[-----------------] [----------------------inst_one---------------------]
[----------------------inst_two---------------------]
+Sampling Start Time [-------------Test Multiple-------------] Test Single
[-------------Test Multiple-------------] Test Single
+ bar dm-1 foo
bar dm-1 foo
+2010-06-25 15:09:06 4 3.3 2.2 1
14 13.3 12.2 11
=======================================
--- /trunk/test/golden/emt_view_multiple Mon Aug 16 21:49:09 2010
+++ /trunk/test/golden/emt_view_multiple Mon Jan 9 20:49:04 2012
@@ -1,7 +1,6 @@
test_multiple Test Multiple
- This is a multie value field
+ This is a multi value field
foo
bar
- bar
- foo
-
+ dm-1
+
=======================================
--- /trunk/test/golden/emt_view_multiple.sqlite Fri Feb 11 09:39:21 2011
+++ /trunk/test/golden/emt_view_multiple.sqlite Mon Jan 9 20:49:04 2012
@@ -1,7 +1,6 @@
test_multiple Test Multiple
- This is a multie value field
+ This is a multi value field
foo
bar
- bar
- foo
-
+ dm-1
+
=======================================
--- /trunk/test/golden/gather Fri Jun 25 15:45:34 2010
+++ /trunk/test/golden/gather Mon Jan 9 20:49:04 2012
@@ -1,1 +1,1 @@
-timestamp=2010-06-25
15:09:06,inst_one:test_single=1,inst_one:test_multiple.foo=2,inst_one:test_multiple.bar=3,inst_two:test_single=11,inst_two:test_multiple.foo=12,inst_two:test_multiple.bar=13
+timestamp=2010-06-25
15:09:06,inst_one:test_single=1,inst_one:test_multiple.foo=2.2,inst_one:test_multiple.dm-1=3.3,inst_one:test_multiple.bar=4,inst_two:test_single=11,inst_two:test_multiple.foo=12.2,inst_two:test_multiple.dm-1=13.3,inst_two:test_multiple.bar=14
=======================================
--- /trunk/test/test.sh Fri Feb 11 09:39:21 2011
+++ /trunk/test/test.sh Mon Jan 9 20:49:04 2012
@@ -1,6 +1,8 @@
export EMT_CNF=./etc/emt.cnf
SED_CMD="s/[0-9]{4}-[0-9]{2}-[0-9]{2} ([0-9]{2}:){2}[0-9]{2}/2010-06-25
15:09:06/"
rm -f run/*
+mkdir tmp/
+rm -f tmp/*

echo "Test configuration"
../bin/emt_dump_conf
@@ -30,11 +32,10 @@
echo "Testing multiple field emt_view -l -f test_multiple from sqlite3"
../bin/emt_view -l -f test_multiple | sed -r "$SED_CMD" >
run/emt_view_multiple.sqlite

-diff -u golden/ run/ > /dev/null
-#Don't put an echo here. It makers the tests always pass.
-if [ $? == 1 ]; then
+diff -u golden/ run/
+if [ $? != 0 ]; then
echo
- echo "Test FAILED!";
+ echo "Test FAILED! Here is the diff output:";
echo
diff -u golden/ run/
else

Reply all
Reply to author
Forward
0 new messages