http://code.google.com/p/emt/source/detail?r=215
Added:
/trunk/base/compact_field.php
/trunk/plugins/output/sqlite_old.php
/trunk/test/etc/emt_sqlite_input.cnf
/trunk/test/golden/emt_view.sqlite
/trunk/test/golden/emt_view_multiple.sqlite
/trunk/test/golden/emt_view_single.sqlite
/trunk/test/golden/sqlite3.dat
Deleted:
/trunk/plugins/output/sqlite.php
Modified:
/trunk/base/config_file.php
/trunk/plugins/commands/test.php
/trunk/plugins/fields/test.php
/trunk/plugins/output/local_text.php
/trunk/test/etc/emt.cnf
/trunk/test/test.sh
=======================================
--- /dev/null
+++ /trunk/base/compact_field.php Fri Feb 11 09:39:21 2011
@@ -0,0 +1,158 @@
+<?php
+
+require_once('field.php');
+
+/**
+ * Set of functions for turning a csv line into field objects and
+ * back again.
+ *
+ * The basic format for a field is
+ *
instance:name{sub_field1,sub_field2}={val1,val2},instance:name{sub_field1,sub_field2}={val1,val2}
+ */
+
+/*
+//$lines[] = "foo:apache_requests{q1,q2,q3}={6,7,8}|
foo:apache_bytes{q9,q10,q11}={21,22,23}";
+//$lines[] = "mysql_qps=10|mysql_bytes=10234";
+//$lines[] = "mysql_com{select}={15}|mysql_rows{delete,update}={25,35}";
+
+$lines[] = "foo:apache_requests{q1=6,q2=7,q3=8}|
foo:apache_bytes{q9=21,q10=22,q11=23}";
+$lines[] = "mysql_qps=10|mysql_bytes=10234";
+$lines[] = "mysql_com{select=15}|mysql_rows{delete=25,update=35}";
+
+
+function csv_to_field($line) {
+ $fields = preg_split('/\|/', $line);
+
+ foreach ($fields as $field_str) {
+ $f = new compact_field;
+
+ $f->parse_field_str($field_str);
+
+ print_r($f);
+ print $f->output_str() . "\n";
+
+ }
+}
+
+//*/
+
+
+/**
+ * Transform the compact field string
+ * format of foo:bar{sub1,sub2}={val1,val2}
+ * too and from field objects
+ */
+class compact_field extends field {
+ var $field_str = '';
+ var $fname = 'fname foo';
+ var $namespace = 'namespace foo';
+
+ function parse_field_str($field_str) {
+ $this->field_str = $field_str;
+
+ $this->parse_off_instance_name();
+
+ if (preg_match('/{|}/', $this->field_str)) {
+ $this->parse_complex_field();
+ } else {
+ $this->parse_simple_field();
+ }
+ }
+
+ function parse_simple_field() {
+ $this->multi_value = FALSE;
+
+ list ($key, $value) = split('=', $this->field_str);
+ $name = urldecode($key) . '_field';
+ $this->value = urldecode($value);
+
+ $f = new $name;
+ $this->copy_from_field($f);
+ }
+
+ function parse_complex_field() {
+ $this->multi_value = TRUE;
+
+ preg_match('/([a-zA-Z_]+){([a-zA-Z0-9%,=._-]+)}/',
$this->field_str, $matches);
+// print "Parsing from (" . $this->field_str . ")\n";
+// print_r($matches);
+
+ if (count($matches) != 3) {
+ print "Invalid complex field (" . $this->field_str . ")\n";
+ }
+
+ list ($trash, $name, $sub_csv) = $matches;
+ $name .= '_field';
+
+ $f = new $name;
+ //print_r($this);
+
+ $sub_csv = split(',', $sub_csv);
+
+ foreach ($sub_csv as $kv) {
+ list($key, $value) = split('=', $kv);
+ $this->values[urldecode($key)] = urldecode($value);
+ }
+
+ $this->copy_from_field($f);
+ }
+
+ function parse_off_instance_name() {
+ if (strstr($this->field_str, ':')) {
+ list ($this->instance_name, $trash) = split(':',
$this->field_str);
+ $this->field_str = str_replace($this->instance_name . ':', '',
$this->field_str);
+
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ function output_str() {
+ $str = '';
+
+ if ($this->instance_name)
+ $str = $this->instance_name . ':';
+
+ $str .= urlencode($this->name);
+
+ //"foo:bar{foo=1,bar=2,baz=3,bin=4}"
+// "foo:bar{foo,bar,baz,bin}={1,2,3,4}"
+
+ if ($this->multi_value) {
+ $str .= '{';
+ $keys = $values = '';
+
+ foreach ($this->values as $key => $value)
+ $str .= urlencode($key) . '=' . urlencode($value) . ',';
+
+ $str = preg_replace('/,$/', '', $str) . '}';
+ } else {
+ $str .= "=" . urlencode($this->value);
+ }
+
+ return $str;
+ }
+
+
+ function copy_from_field($field) {
+ $properties = array(
+ 'name',
+ 'namespace',
+ 'description',
+ 'fname',
+ 'type',
+ 'command',
+ 'precision',
+ 'multi_value',
+ 'display_format'
+ );
+
+ foreach ($properties as $p)
+ $this->$p = $field->$p;
+ }
+}
+/*
+foreach ($lines as $l)
+ csv_to_field($l);
+// */
=======================================
--- /dev/null
+++ /trunk/plugins/output/sqlite_old.php Fri Feb 11 09:39:21 2011
@@ -0,0 +1,227 @@
+<?php
+/***************************************************************************
+* Copyright (C) 2007 by Eric Bergen *
+* er...@provenscaling.com *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Lesser General Public License as
published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more
details. *
+* *
+* You should have received a copy of the GNU Lesser General Public
License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
+
+register_io_handler('sqlite_output');
+class sqlite_general extends emt_io
+{
+ var $dbh;
+
+ function sql_error()
+ {
+ $array = $this->dbh->errorInfo();
+ return $array[2];
+ }
+
+ function open()
+ {
+ if (!isset($this->config['data_file']))
+ log_error_and_exit("sqlite output handler needs a data_file
specified under [sqlite_output] in emt.cnf");
+
+ if (!($this->dbh = new PDO('sqlite:' .
$this->config['data_file'])))
+ log_error_and_exit('sqlite output handler cannot open data
file, error (' . $this->dbh->errorInfo());
+ }
+
+ /**
+ * This function is here because
+ * if not exists doesn't seem to
+ * work correctly through the
+ * pdo driver
+ */
+
+ function table_exists($table)
+ {
+ $query = "select 1 from sqlite_master where type='table' and
name='$table'";
+ $result = $this->dbh->query($query)
+ or die(log_error_and_exit("Query $query failed with error: " .
$this->sql_error()));
+
+ if ($result->fetch())
+ $result = TRUE;
+ else
+ $result = FALSE;
+
+ return $result;
+ }
+}
+
+class sqlite_output extends sqlite_general
+{
+ var $stmt;
+
+ function write($field)
+ {
+ if ($field->name == 'timestamp')
+ {
+ //sqlite doesn't support timestamps
+ $this->timestamp = strtotime($field->value);
+ }
+
+ if ($field->instance_name)
+ $f_name = $field->instance_name . ':' . $field->name;
+ else
+ $f_name = $field->name;
+
+ if ($field->multi_value == FALSE)
+ {
+ if (!$field->is_value_valid($field->value))
+ log_error("Field {$f_name} tried to write an invalid value
of ({$field->value})");
+ else
+ $this->output .= $f_name . '=' . $field->value . ',';
+ }
+ else
+ {
+ foreach ($field->values as $key => $value)
+ {
+ if (!$field->is_value_valid($value))
+ log_error("Field $f_name tried to write an invalid
value of ($value)");
+ else
+ $this->output .= $f_name . '.' . $key . '=' .
$value . ',';
+ }
+ }
+
+ /**
+ * Writes out the more normalized field specific
+ * tables. Eventually the viewer methods should
+ * be switched over to these tables and
+ * the emt_simple table should be dropped.
+ */
+ $this->write_complex($field);
+ }
+
+ function write_complex($field)
+ {
+ if ($field->multi_value)
+ {
+ if (!$this->table_exists($field->name))
+ {
+ $query = "create table `{$field->name}` (ts integer, name
varchar, value int, unique (ts, name))";
+
+ if ($this->dbh->exec($query) === FALSE)
+ {
+ log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
+ }
+
+ }
+
+ foreach ($field->values as $key => $value)
+ {
+ if (!$field->is_value_valid($value))
+ log_error("Field {$field->name} tried to write an
invalid value of ($value)");
+
+ $query = "insert into `{$field->name}` (ts, name, value)
values ";
+ $query .= "('{$this->timestamp}', '$key', '$value'),\n";
+
+ $query = substr($query, 0, -2);
+ if ($this->dbh->exec($query) === FALSE)
+ log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
+ }
+ }
+ else
+ {
+ if (!$field->is_value_valid($field->value))
+ log_error("Field {$field->name} tried to write an invalid
value of ({$field->value})");
+
+ if (!$this->table_exists($field->name))
+ {
+ $query = "create table `{$field->name}` (ts integer, value
int, unique (ts))";
+
+ if ($this->dbh->exec($query) === FALSE)
+ log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
+ }
+
+ $query = "INSERT INTO `{$field->name}` (ts, value) values
('{$this->timestamp}', '{$field->value}')";
+ if ($this->dbh->exec($query) === FALSE)
+ log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
+ }
+ }
+
+ /**
+ * This function needs to be converted from
+ * using the emt_simple table over
+ * to the new per field tables
+ */
+ function read_date_range($start, $end, $limit = '')
+ {
+ $start = strtotime($start);
+ $end = strtotime($end);
+ $this->query = "select data from emt_simple where ts between
$start and $end order by ts";
+
+ if ($limit != '')
+ $this->query .= " limit $limit";
+
+ return $this->read_based_on_query();
+ }
+
+ /**
+ * This function needs to be converted from
+ * using the emt_simple table over
+ * to the new per field tables
+ */
+ function read_last_records($count)
+ {
+ $count++;
+ $this->query = "select data from (select data,ts from emt_simple
order by ts desc limit $count) order by ts";
+ return $this->read_based_on_query();
+ }
+
+ function next()
+ {
+ $line = $this->stmt->fetch();
+
+ if (!$line)
+ return FALSE;
+
+ return $this->line_into_field_objects($line[0]);
+ }
+
+ function reset()
+ {
+ $this->stmt->closeCursor();
+
+ if (($this->stmt = $this->dbh->query($this->query)) === FALSE)
+ log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
+ }
+
+ function read_based_on_query()
+ {
+ if (($this->stmt = $this->dbh->query($this->query)) === FALSE)
+ log_error_and_exit("Query {$this->query} failed with
error: " . $this->sql_error());
+ }
+
+ function close()
+ {
+ if (!($this->table_exists('emt_simple')))
+ {
+ $query = "create table emt_simple (ts integer, data text,
unique (ts))";
+
+ if ($this->dbh->exec($query) === FALSE)
+ log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
+ }
+
+ $this->output = preg_replace('/^,\s*/', '', $this->output);
+
+ $query = "insert into emt_simple (ts, data)
values('{$this->timestamp}', '{$this->output}')";
+
+ if (($stmt = $this->dbh->exec($query)) === FALSE)
+ log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
+ }
+}
+
+
=======================================
--- /dev/null
+++ /trunk/test/etc/emt_sqlite_input.cnf Fri Feb 11 09:39:21 2011
@@ -0,0 +1,7 @@
+[emt_view]
+default_view = default
+output_records = 100
+input_handler=sqlite3
+
+[sqlite3]
+data_file=./run/sqlite3.dat
=======================================
--- /dev/null
+++ /trunk/test/golden/emt_view.sqlite Fri Feb 11 09:39:21 2011
@@ -0,0 +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
=======================================
--- /dev/null
+++ /trunk/test/golden/emt_view_multiple.sqlite Fri Feb 11 09:39:21 2011
@@ -0,0 +1,7 @@
+test_multiple Test Multiple
+ This is a multie value field
+ foo
+ bar
+ bar
+ foo
+
=======================================
--- /dev/null
+++ /trunk/test/golden/emt_view_single.sqlite Fri Feb 11 09:39:21 2011
@@ -0,0 +1,3 @@
+test_single Test Single
+ This is a single field
+
=======================================
--- /dev/null
+++ /trunk/test/golden/sqlite3.dat Fri Feb 11 09:39:21 2011
Binary file, no diff available.
=======================================
--- /trunk/plugins/output/sqlite.php Tue Jul 21 22:53:53 2009
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-/***************************************************************************
-* Copyright (C) 2007 by Eric Bergen *
-* er...@provenscaling.com *
-* *
-* This program is free software; you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as
published by *
-* the Free Software Foundation; either version 2 of the License, or *
-* (at your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more
details. *
-* *
-* You should have received a copy of the GNU Lesser General Public
License *
-* along with this program; if not, write to the *
-* Free Software Foundation, Inc., *
-* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
-***************************************************************************/
-
-register_io_handler('sqlite_output');
-class sqlite_general extends emt_io
-{
- var $dbh;
-
- function sql_error()
- {
- $array = $this->dbh->errorInfo();
- return $array[2];
- }
-
- function open()
- {
- if (!isset($this->config['data_file']))
- log_error_and_exit("sqlite output handler needs a data_file
specified under [sqlite_output] in emt.cnf");
-
- if (!($this->dbh = new PDO('sqlite:' .
$this->config['data_file'])))
- log_error_and_exit('sqlite output handler cannot open data
file, error (' . $this->dbh->errorInfo());
- }
-
- /**
- * This function is here because
- * if not exists doesn't seem to
- * work correctly through the
- * pdo driver
- */
-
- function table_exists($table)
- {
- $query = "select 1 from sqlite_master where type='table' and
name='$table'";
- $result = $this->dbh->query($query)
- or die(log_error_and_exit("Query $query failed with error: " .
$this->sql_error()));
-
- if ($result->fetch())
- $result = TRUE;
- else
- $result = FALSE;
-
- return $result;
- }
-}
-
-class sqlite_output extends sqlite_general
-{
- var $stmt;
-
- function write($field)
- {
- if ($field->name == 'timestamp')
- {
- //sqlite doesn't support timestamps
- $this->timestamp = strtotime($field->value);
- }
-
- if ($field->instance_name)
- $f_name = $field->instance_name . ':' . $field->name;
- else
- $f_name = $field->name;
-
- if ($field->multi_value == FALSE)
- {
- if (!$field->is_value_valid($field->value))
- log_error("Field {$f_name} tried to write an invalid value
of ({$field->value})");
- else
- $this->output .= $f_name . '=' . $field->value . ',';
- }
- else
- {
- foreach ($field->values as $key => $value)
- {
- if (!$field->is_value_valid($value))
- log_error("Field $f_name tried to write an invalid
value of ($value)");
- else
- $this->output .= $f_name . '.' . $key . '=' .
$value . ',';
- }
- }
-
- /**
- * Writes out the more normalized field specific
- * tables. Eventually the viewer methods should
- * be switched over to these tables and
- * the emt_simple table should be dropped.
- */
- $this->write_complex($field);
- }
-
- function write_complex($field)
- {
- if ($field->multi_value)
- {
- if (!$this->table_exists($field->name))
- {
- $query = "create table `{$field->name}` (ts integer, name
varchar, value int, unique (ts, name))";
-
- if ($this->dbh->exec($query) === FALSE)
- {
- log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
- }
-
- }
-
- foreach ($field->values as $key => $value)
- {
- if (!$field->is_value_valid($value))
- log_error("Field {$field->name} tried to write an
invalid value of ($value)");
-
- $query = "insert into `{$field->name}` (ts, name, value)
values ";
- $query .= "('{$this->timestamp}', '$key', '$value'),\n";
-
- $query = substr($query, 0, -2);
- if ($this->dbh->exec($query) === FALSE)
- log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
- }
- }
- else
- {
- if (!$field->is_value_valid($field->value))
- log_error("Field {$field->name} tried to write an invalid
value of ({$field->value})");
-
- if (!$this->table_exists($field->name))
- {
- $query = "create table `{$field->name}` (ts integer, value
int, unique (ts))";
-
- if ($this->dbh->exec($query) === FALSE)
- log_error_and_exit("Query $query failed with
error: " . $this->sql_error());
- }
-
- $query = "INSERT INTO `{$field->name}` (ts, value) values
('{$this->timestamp}', '{$field->value}')";
- if ($this->dbh->exec($query) === FALSE)
- log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
- }
- }
-
- /**
- * This function needs to be converted from
- * using the emt_simple table over
- * to the new per field tables
- */
- function read_date_range($start, $end, $limit = '')
- {
- $start = strtotime($start);
- $end = strtotime($end);
- $this->query = "select data from emt_simple where ts between
$start and $end order by ts";
-
- if ($limit != '')
- $this->query .= " limit $limit";
-
- return $this->read_based_on_query();
- }
-
- /**
- * This function needs to be converted from
- * using the emt_simple table over
- * to the new per field tables
- */
- function read_last_records($count)
- {
- $count++;
- $this->query = "select data from (select data,ts from emt_simple
order by ts desc limit $count) order by ts";
- return $this->read_based_on_query();
- }
-
- function next()
- {
- $line = $this->stmt->fetch();
-
- if (!$line)
- return FALSE;
-
- return $this->line_into_field_objects($line[0]);
- }
-
- function reset()
- {
- $this->stmt->closeCursor();
-
- if (($this->stmt = $this->dbh->query($this->query)) === FALSE)
- log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
- }
-
- function read_based_on_query()
- {
- if (($this->stmt = $this->dbh->query($this->query)) === FALSE)
- log_error_and_exit("Query {$this->query} failed with
error: " . $this->sql_error());
- }
-
- function close()
- {
- if (!($this->table_exists('emt_simple')))
- {
- $query = "create table emt_simple (ts integer, data text,
unique (ts))";
-
- if ($this->dbh->exec($query) === FALSE)
- log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
- }
-
- $this->output = preg_replace('/^,\s*/', '', $this->output);
-
- $query = "insert into emt_simple (ts, data)
values('{$this->timestamp}', '{$this->output}')";
-
- if (($stmt = $this->dbh->exec($query)) === FALSE)
- log_error_and_exit("Query $query failed with error: " .
$this->sql_error());
- }
-}
-
-
=======================================
--- /trunk/base/config_file.php Tue Mar 31 18:50:16 2009
+++ /trunk/base/config_file.php Fri Feb 11 09:39:21 2011
@@ -30,10 +30,6 @@
$config = array();
$module_instances = array();
-parse_single_config_file($file_name);
-
-if (isset($config['global']['extra_config_dir']))
- parse_dir($config['global']['extra_config_dir']);
function parse_dir($extra_config_dir = "/etc/emt.d/")
{
@@ -127,3 +123,8 @@
return $fp;
}
+
+parse_single_config_file($file_name);
+
+if (isset($config['global']['extra_config_dir']))
+ parse_dir($config['global']['extra_config_dir']);
=======================================
--- /trunk/plugins/commands/test.php Fri Oct 8 10:14:42 2010
+++ /trunk/plugins/commands/test.php Fri Feb 11 09:39:21 2011
@@ -33,9 +33,10 @@
$var = 0;
$this->cmd = "echo " .
- "test_single=" . (1 + $var) .
- ",test_multiple.foo=" . (2 + $var) .
- ",test_multiple.bar=" . (3 + $var);
+ "test_single=" . (1 + $var + .01) .
+ ",test_multiple.foo=" . (2 + $var + .2) .
+ ",test_multiple.dm-1=" . (3 + $var + .3) .
+ ",test_multiple.bar=" . (4 + $var);
}
}
=======================================
--- /trunk/plugins/fields/test.php Fri Oct 8 10:14:42 2010
+++ /trunk/plugins/fields/test.php Fri Feb 11 09:39:21 2011
@@ -27,7 +27,7 @@
var $fname = 'Test Single';
var $description = 'This is a single field';
var $type = 'incr';
- var $precision = 0;
+ var $precision = 1;
var $command = 'test_command';
}
@@ -39,7 +39,7 @@
var $fname = 'Test Multiple';
var $description = 'This is a multie value field';
var $type = 'incr';
- var $precision = 0;
+ var $precision = 1;
var $command = 'test_command';
var $multi_value = TRUE;
}
=======================================
--- /trunk/plugins/output/local_text.php Mon Aug 23 23:37:48 2010
+++ /trunk/plugins/output/local_text.php Fri Feb 11 09:39:21 2011
@@ -38,7 +38,7 @@
* This fixes a bug where running emt_view before the file existed
created the file as the user
* that ran emt_view
*/
- if (!($this->fp = fopen($this->config['output_file'], 'r')))
+ if (!($this->fp = @fopen($this->config['output_file'], 'r')))
log_error("Unable to open csv file " .
$this->config['output_file']);
}
@@ -74,7 +74,7 @@
if ($this->output)
{
- fclose($this->fp);
+ @fclose($this->fp);
if (!($this->fp = fopen($this->config['output_file'], 'a')))
log_error_and_exit("Unable to open log file " .
$this->config['output_file']);
=======================================
--- /trunk/test/etc/emt.cnf Fri Oct 8 10:14:42 2010
+++ /trunk/test/etc/emt.cnf Fri Feb 11 09:39:21 2011
@@ -5,8 +5,9 @@
field=timestamp
field=test_single
field=test_multiple
-field=time_me_out
+#field=time_me_out
output_handler=local_text
+output_handler=sqlite3
instances = 2
[test_command:inst_one]
@@ -18,6 +19,9 @@
[local_text]
output_file=./run/gather
+[sqlite3]
+data_file=./run/sqlite3.dat
+
[emt_view]
default_view = default
output_records = 100
=======================================
--- /trunk/test/test.sh Fri Oct 8 10:14:42 2010
+++ /trunk/test/test.sh Fri Feb 11 09:39:21 2011
@@ -1,6 +1,6 @@
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 run/*
+rm -f run/*
echo "Test configuration"
../bin/emt_dump_conf
@@ -10,14 +10,26 @@
sed -r "$SED_CMD" < run/gather > /tmp/t;
mv /tmp/t run/gather;
-echo "Testing emt_view output"
+echo "Testing emt_view output from local_text"
../bin/emt_view -f test_single,test_multiple | sed -r "$SED_CMD" >
run/emt_view
-echo "Testing single field emt_view -l -f"
+echo "Testing single field emt_view -l -f test_single from local_text"
../bin/emt_view -l -f test_single | sed -r "$SED_CMD" >
run/emt_view_single
-echo "Testing multiple field emt_view -l -f"
+echo "Testing multiple field emt_view -l -f test_multiple from local_text"
../bin/emt_view -l -f test_multiple | sed -r "$SED_CMD" >
run/emt_view_multiple
+
+export EMT_CNF=./etc/emt_sqlite_input.cnf
+
+echo "Testing emt_view output from sqlite3"
+../bin/emt_view -f test_single,test_multiple | sed -r "$SED_CMD" >
run/emt_view.sqlite
+
+echo "Testing single field emt_view -l -f test_single from sqlite3"
+../bin/emt_view -l -f test_single | sed -r "$SED_CMD" >
run/emt_view_single.sqlite
+
+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