From 7aa3f2d5caab4b498fedcd965d45c8407770629e Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Mon, 5 Sep 2016 22:54:03 +0300 Subject: [PATCH] Test driver-specific option descriptions separately from the main help text. --- tests/help.t | 42 +++++++++++++++++++++--------------------- tests/help_drv_mysql.t | 24 ++++++++++++++++++++++++ tests/help_drv_pgsql.t | 15 +++++++++++++++ 3 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 tests/help_drv_mysql.t create mode 100644 tests/help_drv_pgsql.t diff --git a/tests/help.t b/tests/help.t index 629687f..6eabac3 100644 --- a/tests/help.t +++ b/tests/help.t @@ -1,4 +1,11 @@ - $ sysbench help +######################################################################## +Skip everything between "Compiled-in database drivers:" and +"Compiled-in tests:" as that part depends on available database +drivers and thus, build options. Driver-specific options is tested +separately. +######################################################################## + + $ sysbench help | sed '/Compiled-in database drivers:/,/Compiled-in tests:/d' sysbench 0.5: multi-threaded system evaluation benchmark Usage: @@ -41,26 +48,6 @@ --db-debug=[on|off] print database-specific debug information [off] - Compiled-in database drivers: - mysql - MySQL driver - - mysql options: - --mysql-host=[LIST,...] MySQL server host [localhost] - --mysql-port=N MySQL server port [3306] - --mysql-socket=[LIST,...] MySQL socket - --mysql-user=STRING MySQL user [sbtest] - --mysql-password=STRING MySQL password [] - --mysql-db=STRING MySQL database name [sbtest] - --mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb] - --mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto] - --mysql-ssl=[on|off] use SSL connections, if available in the client library [off] - --mysql-compression=[on|off] use compression, if available in the client library [off] - --myisam-max-rows=N max-rows parameter for MyISAM tables [1000000] - --mysql-debug=[on|off] dump all client library calls [off] - --mysql-ignore-errors=[LIST,...]list of errors to ignore, or "all" [1213,1020,1205] - --mysql-dry-run=[on|off] Dry run, pretent that all MySQL client API calls are successful without executing them [off] - - Compiled-in tests: fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test @@ -69,3 +56,16 @@ See 'sysbench --test= help' for a list of options for each test. + +######################################################################## +Test driver-specific options +######################################################################## + $ drivers=$(sysbench help | sed -n '/Compiled-in database drivers:/,/^$/p' | tail -n +2 | cut -d ' ' -f 3) + $ for drv in $drivers + > do + > if [ ! -r ${SBTEST_ROOTDIR}/help_drv_${drv}.t ] + > then + > echo "Cannot find test(s) for $drv driver options!" + > exit 1 + > fi + > done diff --git a/tests/help_drv_mysql.t b/tests/help_drv_mysql.t new file mode 100644 index 0000000..47ef508 --- /dev/null +++ b/tests/help_drv_mysql.t @@ -0,0 +1,24 @@ +Skip test if the MySQL driver is not available. + + $ if ! sysbench help | sed -n '/Compiled-in database drivers:/,/^$/p' | grep mysql > /dev/null 2>&1 + > then + > exit 80 + > fi + + $ sysbench help | sed -n '/mysql options:/,/^$/p' + mysql options: + --mysql-host=[LIST,...] MySQL server host [localhost] + --mysql-port=N MySQL server port [3306] + --mysql-socket=[LIST,...] MySQL socket + --mysql-user=STRING MySQL user [sbtest] + --mysql-password=STRING MySQL password [] + --mysql-db=STRING MySQL database name [sbtest] + --mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb] + --mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto] + --mysql-ssl=[on|off] use SSL connections, if available in the client library [off] + --mysql-compression=[on|off] use compression, if available in the client library [off] + --myisam-max-rows=N max-rows parameter for MyISAM tables [1000000] + --mysql-debug=[on|off] dump all client library calls [off] + --mysql-ignore-errors=[LIST,...]list of errors to ignore, or "all" [1213,1020,1205] + --mysql-dry-run=[on|off] Dry run, pretent that all MySQL client API calls are successful without executing them [off] + diff --git a/tests/help_drv_pgsql.t b/tests/help_drv_pgsql.t new file mode 100644 index 0000000..b4d788c --- /dev/null +++ b/tests/help_drv_pgsql.t @@ -0,0 +1,15 @@ +Skip test if the PostgreSQL driver is not available. + + $ if ! sysbench help | sed -n '/Compiled-in database drivers:/,/^$/p' | grep pgsql > /dev/null 2>&1 + > then + > exit 80 + > fi + + $ sysbench help | sed -n '/pgsql options:/,/^$/p' + pgsql options: + --pgsql-host=STRING PostgreSQL server host [localhost] + --pgsql-port=N PostgreSQL server port [5432] + --pgsql-user=STRING PostgreSQL user [sbtest] + --pgsql-password=STRING PostgreSQL password [] + --pgsql-db=STRING PostgreSQL database name [sbtest] +