[syslog-ng] [PATCH] check: run the sql functional test case if sql is available on the system
Balazs Scheidler
bazsi at balabit.hu
Sat Jun 4 15:13:08 CEST 2011
Hi,
Thanks for your contribution. I had a similar patch already committed,
which generalizes the "are we to run this test?" question, so that you
we don't have to change the func_test.py script.
I've incorporated your proposed SQL check into the check_env() function
for test_sql().
And while I was at it, I've added autodetection whether the SQL module
was enabled or not.
On Tue, 2011-05-17 at 17:59 +0200, Juhasz Viktor wrote:
> differences between files attachment (func_test.patch)
> [func_test] Run sql functional testcase only if sql is available.
>
> Signed-off-by: Viktor Juhasz (jviktor at balabit.hu)
> ---
> diff --git a/tests/functional/func_test.py b/tests/functional/func_test.py
> index 36f3453..aa2d877 100755
> --- a/tests/functional/func_test.py
> +++ b/tests/functional/func_test.py
> @@ -64,7 +64,9 @@ import test_input_drivers
> import test_performance
> import test_sql
>
> -tests = (test_input_drivers, test_sql, test_file_source, test_filters, test_performance)
> +tests = (test_input_drivers, test_file_source, test_filters, test_performance)
> +if has_sql():
> + tests = (test_input_drivers, test_sql, test_file_source, test_filters, test_performance)
>
> init_env()
> seed_rnd()
> diff --git a/tests/functional/globals.py b/tests/functional/globals.py
> index 8b4dcd0..1839abc 100644
> --- a/tests/functional/globals.py
> +++ b/tests/functional/globals.py
> @@ -1,4 +1,6 @@
> import os
> +from log import *
> +
>
> def is_premium():
> version = os.popen('../../syslog-ng/syslog-ng -V', 'r').read()
> @@ -6,6 +8,23 @@ def is_premium():
> return True
> return False
>
> +def has_sql():
> + paths=('/opt/syslog-ng/bin', '/usr/bin', '/usr/local/bin')
> + found=False
> + for pth in paths:
> + if os.path.isfile(os.path.join(pth, 'sqlite3')):
> + found = True
> + if not found:
> + print_user("no sqlite3 tool, skipping SQL test")
> + return False
> +
> + soext='.so'
> + if re.match('hp-ux', sys.platform) and not re.match('ia64', os.uname()[4]):
> + soext='.sl'
> + if not os.path.isfile('/opt/syslog-ng/lib/dbd/libdbdsqlite3%s' % soext):
> + print_user('No sqlite3 backend for libdbi. Skipping SQL test')
> + return False
> + return True
>
> is_premium_edition = is_premium()
> if is_premium_edition:
> diff --git a/tests/functional/test_sql.py b/tests/functional/test_sql.py
> index 13786e2..552c389 100644
> --- a/tests/functional/test_sql.py
> +++ b/tests/functional/test_sql.py
> @@ -41,7 +41,8 @@ def check_env():
>
>
> def test_sql():
> -
> + if not has_sql():
> + return True
> messages = (
> 'sql1',
> 'sql2'
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.campin.net/syslog-ng/faq.html
>
--
Bazsi
More information about the syslog-ng
mailing list