Rename sysbench.option_defs to sysbench.cmdline.options.

This commit is contained in:
Alexey Kopytov
2017-02-01 19:31:53 +03:00
parent b5b1878740
commit 9fdec9dccf
6 changed files with 31 additions and 28 deletions

View File

@ -73,28 +73,30 @@ local arg_types = {
}
-- Parse command line options definitions, if present in the script as a
-- 'sysbench.option_defs' table. If no such table exists, or if there a parsing
-- error, return false. Return true on success.
function sysbench.cmdline.read_option_defs()
if sysbench.option_defs == nil then
-- 'sysbench.cmdline.options' table. If no such table exists, or if there a
-- parsing error, return false. Return true on success. After parsing the
-- command line arguments, option values are available as the sysbench.opt
-- table.
function sysbench.cmdline.read_cmdline_options()
if sysbench.cmdline.options == nil then
return true
end
local t = type(sysbench.option_defs)
assert(t == "table", "wrong type for sysbench.option_defs: " .. t)
local t = type(sysbench.cmdline.options)
assert(t == "table", "wrong type for sysbench.cmdline.options: " .. t)
local i = 0
for name, def in pairs(sysbench.option_defs) do
for name, def in pairs(sysbench.cmdline.options) do
i = i+1
end
local args = ffi.new('sb_arg_t[?]', i)
i = 0
for name, def in pairs(sysbench.option_defs) do
for name, def in pairs(sysbench.cmdline.options) do
-- name
assert(type(name) == "string" and type(def) == "table",
"wrong table structure in sysbench.option_defs")
"wrong table structure in sysbench.cmdline.options")
args[i].name = name
-- description
@ -171,7 +173,8 @@ void sb_print_test_options(void);
]]
-- ----------------------------------------------------------------------
-- Print descriptions of command line options, if defined by option_defs
-- Print descriptions of command line options, if defined by
-- sysbench.cmdline.options
-- ----------------------------------------------------------------------
function sysbench.cmdline.print_test_options()
ffi.C.sb_print_test_options()

View File

@ -30,7 +30,7 @@ if sysbench.cmdline.command == nil then
end
-- Command line options
sysbench.option_defs = {
sysbench.cmdline.options = {
table_size =
{"Number of rows per table", 10000},
range_size =

View File

@ -9,7 +9,7 @@
require("oltp_common")
-- Add random_points to the list of standard OLTP options
sysbench.option_defs.random_points =
sysbench.cmdline.options.random_points =
{"Number of random points in the IN() clause in generated SELECTs", 10}
-- Override standard prepare/cleanup OLTP functions, as this benchmark does not

View File

@ -9,9 +9,9 @@
require("oltp_common")
-- Add --number-of-ranges and --delta to the list of standard OLTP options
sysbench.option_defs.number_of_ranges =
sysbench.cmdline.options.number_of_ranges =
{"Number of random BETWEEN ranges per SELECT", 10}
sysbench.option_defs.delta =
sysbench.cmdline.options.delta =
{"Size of BETWEEN ranges", 5}
-- Override standard prepare/cleanup OLTP functions, as this benchmark does not