public class BatteryTest extends Object
tests.bt:
collections/collperf.conf numHosts=5
locks/locktest.conf
include ${JTESTS}/license/license.bt
This will run the tests
$JTESTS/collections/collperf.conf and
$JTESTS/locks/locktest.conf.
A .bt file can live anywhere, for example, in the same directory as the tests it references.
Tests can be commented out using C or C++ style comments. Multiple tests can be listed on the same line as long as they are separated by whitespace. A test name can only contain whitespace if it is quoted.
A test can depend on any number of "system properties" used in the hydra configuration file via the ${} syntax. Properties are passed to the hydra master and used when parsing the hydra configuration file. They are intended for use only when using regular hydra configuration parameters would be cumbersome, for example, when scaling the number of hosts used in a test. See hydra_grammar.txt for more details on using properties in test configurations.
Default values for system properties can optionally be specified in a .prop file by the same name and in the same directory as the test, whether that is relative to the current directory or to $JTESTS. Batterytest will seek the .prop file automatically. There is no need to indicate to batterytest whether such a file exists, and there is no way to force batterytest to look in another location for this file.
The onlyOnPlatforms
system property can be used to specify the platforms on which a
test is be run. If onlyOnPlatforms is set to a value
that doesn't contain the current platform, the test is not run.
Values for properties can also be specified after the test name in the .bt file. Any properties specified in the .bt file will override those in the .prop file. A property value cannot contain whitespace. They can be given on the same line as the test or on subsequent lines. Each property must be separated from the next with whitespace.
To override hydra configuration parameters for all tests in a suite, create a "local.conf" file in the directory where batterytest is being run. Or, specify an alternative local.conf on the command line.
Usage:
java -DGEMFIRE=<path_to_gemfire_product_tree>
-DJTESTS=<path_to_test_classes>
-DtestFileName=<batterytest_input_file>
[-DHADOOP_DIST=<path_to_Hadoop_distribution>]
[-DEXTRA_JTESTS=<path_to_test_auxiliary_classes>]
[-DGFMON=<path_to_product-testcopy_in_gfmon_product_tree>]
[-DREGRESSION_EXTRA_PATH=<extra_path_elements_in_autogenerated_regression_directory>]
[-DRELEASE_DIR=<path_to_gemfire_release_dir>]
[-DJPROBE=<path_to_jprobe_product_tree>]
[-DlocalConf=<local_conf_filename(default:$pwd/local.conf)>]
[-DresultDir=<cwd_for_batterytest(default:$cwd)>]
[-DnumTimesToRun=<number_of_times_to_run_tests_in_input_file(default:1)>]
[-DlogLevel=<batterytest_log_level(default:info)>]
[-DprovideRegressionSummary=<whether_to_provide_a_regression_summary_report(default:true)>]
[-DremovePassedTest=<whether_to_remove_test_result_dir_for_passed_tests(default:false)>]
[-DcodeCoverage=<javaagent_command_for_code_coverage(default:null)>]
[-DgrepLogs=<search logs for suspect strings(default:false)>]
[-DgrepLogsHeapMB=<max_size_of_greplogs_heap_in_megabytes(default:unspecified)>]
[-DgrepLogsWaitSec=<time_in_seconds_to_wait_for_grepLogs_to_complete(default:3600)>]
[-DnukeHungTest=<whether_to_nuke_hung_test_and_keep_going(default:true)>]
[-DmoveRemoteDirs=<whether_to_move_remote_dirs_to_master_dir(default:false)>]
[-DmoveHadoopData=<whether_to_move_hadoop_data_dirs_to_master_dir(default:false)>]
[-DparseOnly=<whether_to_only_parse_test_config(default:false)>]
[-DmasterClasspath=<additional_classpath_for_master(default:null)>]
[-DmasterHeapMB=<max_size_of_master_controller_heap_in_megabytes(default:256)>]
[-DprovideBugReportTemplate=<true if failed run should create a bug report template file(default:false)>]
[-DprovidePropertiesForJenkins=<true if run should create jenkins.prop file for Jenkins to use(default:false)>]
[-DprovideXMLReport=<true if run should create an XML report(default:false)>]
batterytest.BatteryTest [options]
Where options are:
-until date/time
Executes tests until a specific date. Dates are
specified according to FORMAT.
-for duration time-unit
The amount of time tests should be executed.
"duration" is an integer and time-unit is one of
"minutes", "hours", or "days"
-interrupt
Interrupts the currently running test if time specified with -for or -until has elapsed.
-continue
Continues a test run that ended prematurely. It
consults oneliner.txt to determine how many tests have
already been run. It assumes that battery test is
being run with the same .bt file as previous runs.
Example:
java -classpath $JTESTS:$GEMFIRE/lib/gemfire.jar
-DGEMFIRE=$GEMFIRE
-DJTESTS=$JTESTS
-DJPROBE=/export/pippin1/users/tools/jprobe501
-DtestFileName=$JTESTS/smoketest/smoketest.bt
-DnumTimesToRun=2
batterytest.BatteryTest
BatteryTest runs each test in the input file, one after the other.
If numTimesToRun is greater than 1, it repeats the
test suite the specified number of times.
The fully expanded list of tests being run is written to "batterytest.bt",
and is overwritten every time batterytest is invoked. Tests using
"onlyOnPlatforms" are omitted on non-matching platforms.
Results, progress, and a summary report are written to
"batterytest.log". The verbosity of this log is controlled via
logLevel (see LogWriter.
A one-line description of each test result is written to
"oneliner.txt". These files are appended to, if they already
exist. Delete or move them between runs if desired. A result of
"P" means pass, "F" means fail, and "H" means hung.
BatteryTest spawns a process to run a test then watches for that
process to disappear. If, when the process dies, the test
directory contains a file named "in_progress.txt" or "hang.txt",
or if the process fails to die within the batterytest timeout
(currently hardwired at 216000 seconds), BatteryTest reports the
test as hung and terminates its run unless
nukeHungTest is set true. If these conditions are
absent, batterytest reports the test's pass/fail status and moves
on to the next test. The test is reported as failing if it
produces a file named "failed.txt" or it
produces a file named "errors.txt". If none of the failure
conditions hold, the test is reported as passing.
If moveRemoteDirs is true, batterytest executes the script
"movedirs.sh" in the test directory, if it exists and the test was
not left running.
For tests using Hadoop, BatteryTest kills all leftover Hadoop processes by
default and copies the log and data files to the test result directory. It
does this by executing nukehadoop.sh and movehadoop.sh
, respectively. To move the data files instead of removing them, set
moveHadoopData=true. The data files are placed in the
movedHadoopData subdirectory of the test result directory.
To skip killing the processes for a test
hang, set nukeHungTest=false. This causes BatteryTest to skip
executing the Hadoop scripts and terminate, leaving the Hadoop cluster
intact. To clean up the cluster at a later time, execute the scripts
manually.
If parseOnly is true, batterytest sets this property in the
hydra master controller, instructing it to parse the test configurations
without running the tests. This is useful for expanding configurations
that use includes, and comparing them to other runs.
| Modifier and Type | Field and Description |
|---|---|
static String |
FORMAT
The format of the date used for the -until option
|
static String |
JACOCO_FN |
static String |
MOVE_HADOOP_DATA |
| Constructor and Description |
|---|
BatteryTest() |
| Modifier and Type | Method and Description |
|---|---|
static void |
javaGrepLogs(String workdir,
Integer maxHeap,
int maxWaitSec)
Invoke the GrepLogs utility.
|
static void |
main(String[] args) |
static boolean |
runbattery(String[] args) |
public static final String MOVE_HADOOP_DATA
public static final String JACOCO_FN
public static final String FORMAT
SimpleDateFormat,
Constant Field ValuesCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.