14bcd95a3SBarry Smith(test_harness)= 24bcd95a3SBarry Smith 34bcd95a3SBarry Smith# PETSc Testing System 44bcd95a3SBarry Smith 54bcd95a3SBarry SmithThe PETSc test system consists of 64bcd95a3SBarry Smith 74bcd95a3SBarry Smith- Formatted comments at the bottom of the tutorials and test source files that describes the tests to be run. 84bcd95a3SBarry Smith- The *test generator* (`config/gmakegentest.py`) that parses the tutorial and test source files and generates the makefiles and shell scripts. This is run 94bcd95a3SBarry Smith automatically by the make system and rarely is run directly. 104bcd95a3SBarry Smith- The *PETSc test harness* that consists of makefile and shell scripts that runs the executables with several logging and reporting features. 114bcd95a3SBarry Smith 124bcd95a3SBarry SmithDetails on using the harness may be found in the {ref}`user's manual <sec_runningtests>`. The testing system is used by {any}`pipelines`. 134bcd95a3SBarry Smith 144bcd95a3SBarry Smith## PETSc Test Description Language 154bcd95a3SBarry Smith 164bcd95a3SBarry SmithPETSc tests and tutorials contain at the bottom of the their source files a simple language to 174bcd95a3SBarry Smithdescribe tests and subtests required to run executables associated with 184bcd95a3SBarry Smithcompilation of that file. The general skeleton of the file is 194bcd95a3SBarry Smith 204bcd95a3SBarry Smith``` 214bcd95a3SBarry Smithstatic const char help[] = "A simple MOAB example\n"; 224bcd95a3SBarry Smith 234bcd95a3SBarry Smith... 244bcd95a3SBarry Smith<source code> 254bcd95a3SBarry Smith... 264bcd95a3SBarry Smith 274bcd95a3SBarry Smith/*TEST 284bcd95a3SBarry Smith build: 294bcd95a3SBarry Smith requires: moab 304bcd95a3SBarry Smith testset: 314bcd95a3SBarry Smith suffix: 1 324bcd95a3SBarry Smith requires: !complex 334bcd95a3SBarry Smith testset: 344bcd95a3SBarry Smith suffix: 2 354bcd95a3SBarry Smith args: -debug -fields v1,v2,v3 364bcd95a3SBarry Smith test: 374bcd95a3SBarry Smith test: 384bcd95a3SBarry Smith args: -foo bar 394bcd95a3SBarry SmithTEST*/ 404bcd95a3SBarry Smith``` 414bcd95a3SBarry Smith 424bcd95a3SBarry SmithFor our language, a *test* is associated with the following 434bcd95a3SBarry Smith 444bcd95a3SBarry Smith- A single shell script 454bcd95a3SBarry Smith 464bcd95a3SBarry Smith- A single makefile 474bcd95a3SBarry Smith 484bcd95a3SBarry Smith- An output file that represents the *expected results*. It is also possible -- though unusual -- to have multiple output files for a single test 494bcd95a3SBarry Smith 504bcd95a3SBarry Smith- Two or more command tests, usually: 514bcd95a3SBarry Smith 524bcd95a3SBarry Smith - one or more `mpiexec` tests that run the executable 534bcd95a3SBarry Smith - one or more `diff` tests to compare output with the expected result 544bcd95a3SBarry Smith 554bcd95a3SBarry SmithOur language also supports a *testset* that specifies either a new test 564bcd95a3SBarry Smithentirely or multiple executable/diff tests within a single test. At the 574bcd95a3SBarry Smithcore, the executable/diff test combination will look something like 584bcd95a3SBarry Smiththis: 594bcd95a3SBarry Smith 604bcd95a3SBarry Smith```sh 614bcd95a3SBarry Smithmpiexec -n 1 ../ex1 1> ex1.tmp 2> ex1.err 624bcd95a3SBarry Smithdiff ex1.tmp output/ex1.out 1> diff-ex1.tmp 2> diff-ex1.err 634bcd95a3SBarry Smith``` 644bcd95a3SBarry Smith 654bcd95a3SBarry SmithIn practice, we want to do various logging and counting by the test 664bcd95a3SBarry Smithharness; as are explained further below. The input language supports 674bcd95a3SBarry Smithsimple yet flexible test control. 684bcd95a3SBarry Smith 69c3bbc914SBarry Smith(test_harness_data)= 70c3bbc914SBarry Smith 71c3bbc914SBarry Smith### Datafiles needed for some tests 72c3bbc914SBarry Smith 73c3bbc914SBarry SmithSome tests require matrices or meshes that are too large for the primary PETSc Git repository. 74c3bbc914SBarry SmithThe repository [datafiles](https://gitlab.com/petsc/datafiles) contains all the test files needed for the test suite. 75c3bbc914SBarry SmithTo run these tests one must first clone the datafiles repository and then set the environmental variable `DATAFILESPATH`. 76c3bbc914SBarry SmithFor these tests `requires: datafilespath` should be specified. 77c3bbc914SBarry Smith 784bcd95a3SBarry Smith### Runtime Language Options 794bcd95a3SBarry Smith 804bcd95a3SBarry SmithAt the end of each test file, a marked comment block is 814bcd95a3SBarry Smithinserted to describe the test(s) to be run. The elements of the test are 824bcd95a3SBarry Smithdone with a set of supported key words that sets up the test. 834bcd95a3SBarry Smith 844bcd95a3SBarry SmithThe goals of the language are to be 854bcd95a3SBarry Smith 864bcd95a3SBarry Smith- as minimal as possible with the simplest test requiring only one keyword, 874bcd95a3SBarry Smith- independent of the filename such that a file can be renamed without rewriting the tests, and 884bcd95a3SBarry Smith- intuitive. 894bcd95a3SBarry Smith 904bcd95a3SBarry SmithIn order to enable the second goal, the *basestring* of the filename is 914bcd95a3SBarry Smithdefined as the filename without the extension; for example, if the 924bcd95a3SBarry Smithfilename is `ex1.c`, then `basestring=ex1`. 934bcd95a3SBarry Smith 944bcd95a3SBarry SmithWith this background, these keywords are as follows. 954bcd95a3SBarry Smith 964bcd95a3SBarry Smith- **testset** or **test**: (*Required*) 974bcd95a3SBarry Smith 984bcd95a3SBarry Smith - At the top level either a single test or a test set must be 994bcd95a3SBarry Smith specified. All other keywords are sub-entries of this keyword. 1004bcd95a3SBarry Smith 1014bcd95a3SBarry Smith- **suffix**: (*Optional*; *Default:* `suffix=""`) 1024bcd95a3SBarry Smith 1034bcd95a3SBarry Smith - The test name is given by `testname = basestring` if the suffix 1044bcd95a3SBarry Smith is set to an empty string, and by 1054bcd95a3SBarry Smith `testname = basestring + "_" + suffix` otherwise. 1064bcd95a3SBarry Smith - This can be specified only for top level test nodes. 1074bcd95a3SBarry Smith 1084bcd95a3SBarry Smith- **output_file**: (*Optional*; *Default:* 1094bcd95a3SBarry Smith `output_file = "output/" + testname + ".out"`) 1104bcd95a3SBarry Smith 111d2dffbf6SSatish Balay - A reference file with the *expected output from the test run*, 112d2dffbf6SSatish Balay the output from the test run is compared with it (with a difftool). 1134bcd95a3SBarry Smith - This file is described relative to the source directory of the 114d2dffbf6SSatish Balay source file and should be in the `output` subdirectory (for example, 115d2dffbf6SSatish Balay `output/ex1.out`). 1164bcd95a3SBarry Smith 1174bcd95a3SBarry Smith- **nsize**: (*Optional*; *Default:* `nsize=1`) 1184bcd95a3SBarry Smith 1194bcd95a3SBarry Smith - This integer is passed to mpiexec; i.e., `mpiexec -n nsize` 1204bcd95a3SBarry Smith 1214bcd95a3SBarry Smith- **args**: (*Optional*; *Default:* `""`) 1224bcd95a3SBarry Smith 1234bcd95a3SBarry Smith - These arguments are passed to the executable. 1244bcd95a3SBarry Smith 1254bcd95a3SBarry Smith- **diff_args**: (*Optional*; *Default:* `""`) 1264bcd95a3SBarry Smith 1274bcd95a3SBarry Smith - These arguments are passed to the `lib/petsc/bin/petscdiff` script that 1284bcd95a3SBarry Smith is used in the diff part of the test. For example, `-j` enables testing 1294bcd95a3SBarry Smith the floating point numbers. 1304bcd95a3SBarry Smith 1314bcd95a3SBarry Smith- **TODO**: (*Optional*; *Default:* `False`) 1324bcd95a3SBarry Smith 1334bcd95a3SBarry Smith - Setting this Boolean to True will tell the test to appear in the 1344bcd95a3SBarry Smith test harness but report only TODO per the TAP standard. Optionally 1354bcd95a3SBarry Smith provide a string indicating why it is todo. 1364bcd95a3SBarry Smith - A runscript will be generated and can easily be modified by hand 1374bcd95a3SBarry Smith to run. 1384bcd95a3SBarry Smith 1394bcd95a3SBarry Smith- **filter**: (*Optional*; *Default:* `""`) 1404bcd95a3SBarry Smith 1414bcd95a3SBarry Smith - Sometimes only a subset of the output is meant to be tested 1424bcd95a3SBarry Smith against the expected result. If this keyword is used, it filters 1434bcd95a3SBarry Smith the executable output to 1444bcd95a3SBarry Smith compare with `output_file`. 1454bcd95a3SBarry Smith - The value of this is the command to be run, for example, 1464bcd95a3SBarry Smith `grep foo` or `sort -nr`. 1474bcd95a3SBarry Smith - **NOTE: this method of testing error output is NOT recommended. See section on** 1484bcd95a3SBarry Smith {ref}`testing errors <sec_testing_error_testing>` **instead.** If the filter begins 1494bcd95a3SBarry Smith with `Error:`, then the test is assumed to be testing the `stderr` output, and the 1504bcd95a3SBarry Smith error code and output are set up to be tested. 1514bcd95a3SBarry Smith 1524bcd95a3SBarry Smith- **filter_output**: (*Optional*; *Default:* `""`) 1534bcd95a3SBarry Smith 1544bcd95a3SBarry Smith - Sometimes filtering the output file is useful for standardizing 1554bcd95a3SBarry Smith tests. For example, in order to handle the issues related to 1564bcd95a3SBarry Smith parallel output, both the output from the test example and the 1574bcd95a3SBarry Smith output file need to be sorted (since sort does not produce the 1584bcd95a3SBarry Smith same output on all machines). This works the same as filter to 1594bcd95a3SBarry Smith implement this feature 1604bcd95a3SBarry Smith 1614bcd95a3SBarry Smith- **localrunfiles**: (*Optional*; *Default:* `""`) 1624bcd95a3SBarry Smith 1634bcd95a3SBarry Smith - Some tests 1644bcd95a3SBarry Smith require runtime files that are maintained in the source tree. 1654bcd95a3SBarry Smith Files in this (space-delimited) list will be copied over to the 1664bcd95a3SBarry Smith testing directory so they will be found by the executable. If you 1674bcd95a3SBarry Smith list a directory instead of files, it will copy the entire 1684bcd95a3SBarry Smith directory (this is limited currently to a single directory) 1694bcd95a3SBarry Smith - The copying is done by the test generator and not by creating 1704bcd95a3SBarry Smith makefile dependencies. 1714bcd95a3SBarry Smith 1724bcd95a3SBarry Smith- **temporaries**: (*Optional*; *Default:* `""`) 1734bcd95a3SBarry Smith 1744bcd95a3SBarry Smith - Some tests produce temporary files that are read by the filter 1754bcd95a3SBarry Smith to compare to expected results. 1764bcd95a3SBarry Smith Files in this (space-delimited) list will cleared before 1774bcd95a3SBarry Smith the test is run to ensure that stale temporary files are not read. 1784bcd95a3SBarry Smith 1794bcd95a3SBarry Smith- **requires**: (*Optional*; *Default:* `""`) 1804bcd95a3SBarry Smith 1814bcd95a3SBarry Smith - This is a space-delimited list of run requirements (not build 1824bcd95a3SBarry Smith requirements; see Build requirements below). 1834bcd95a3SBarry Smith - In general, the language supports `and` and `not` constructs 1844bcd95a3SBarry Smith using `! => not` and `, => and`. 1854bcd95a3SBarry Smith - MPIUNI should work for all -n 1 examples so this need not be in 1864bcd95a3SBarry Smith the requirements list. 187c3bbc914SBarry Smith - Some tests require matrices or meshes contained in the 1884bcd95a3SBarry Smith directory given by the environmental variable `DATAFILESPATH`. 189c3bbc914SBarry Smith For these tests `requires: datafilespath` is 190c3bbc914SBarry Smith specified. See {any}`test harness data<test_harness_data>` 1914bcd95a3SBarry Smith - Packages are indicated with lower-case specification, for example, 1924bcd95a3SBarry Smith `requires: superlu_dist`. 1934bcd95a3SBarry Smith - Any defined variable in petscconf.h can be specified with the 1944bcd95a3SBarry Smith `defined(...)` syntax, for example, `defined(PETSC_USE_INFO)`. 1954bcd95a3SBarry Smith - Any definition of the form `PETSC_HAVE_FOO` can just use 1964bcd95a3SBarry Smith `requires: foo` similar to how third-party packages are handled. 1974bcd95a3SBarry Smith 1984bcd95a3SBarry Smith- **timeoutfactor**: (*Optional*; *Default:* `"1"`) 1994bcd95a3SBarry Smith 2004bcd95a3SBarry Smith - This parameter allows you to extend the default timeout for an 2014bcd95a3SBarry Smith individual test such that the new timeout time is 2024bcd95a3SBarry Smith `timeout=(default timeout) x (timeoutfactor)`. 2034bcd95a3SBarry Smith - Tests are limited to a set time that is found at the top of 2044bcd95a3SBarry Smith `"config/petsc_harness.sh"` and can be overwritten by passing in 2054bcd95a3SBarry Smith the `TIMEOUT` argument to `gmakefile` 2064bcd95a3SBarry Smith 2074bcd95a3SBarry Smith- **env**: (*Optional*; *Default:* `env=""`) 2084bcd95a3SBarry Smith 2094bcd95a3SBarry Smith - Allows you to set environment variables for the test. Values are copied verbatim to 2104bcd95a3SBarry Smith the runscript and defined and exported prior to all other variables. 2114bcd95a3SBarry Smith 2124bcd95a3SBarry Smith - Variables defined within `env:` blocks are expanded and processed by the shell that 2134bcd95a3SBarry Smith runs the runscript. No prior preprocessing (other than splitting the lines into 2144bcd95a3SBarry Smith separate declarations) is done. This means that any escaping of special characters 2154bcd95a3SBarry Smith must be done in the text of the `TEST` block. 2164bcd95a3SBarry Smith 2174bcd95a3SBarry Smith - Defining the `env:` keyword more than once is allowed. Subsequent declarations are 2184bcd95a3SBarry Smith then appended to prior list of declarations . Multiple environment variables may also 2194bcd95a3SBarry Smith be defined in the same `env:` block, i.e. given a test `ex1.c` with the following 2204bcd95a3SBarry Smith spec: 2214bcd95a3SBarry Smith 2224bcd95a3SBarry Smith ```yaml 2234bcd95a3SBarry Smith test: 2244bcd95a3SBarry Smith env: FOO=1 BAR=1 2254bcd95a3SBarry Smith 2264bcd95a3SBarry Smith # equivalently 2274bcd95a3SBarry Smith test: 2284bcd95a3SBarry Smith env: FOO=1 2294bcd95a3SBarry Smith env: BAR=1 2304bcd95a3SBarry Smith ``` 2314bcd95a3SBarry Smith 2324bcd95a3SBarry Smith results in 2334bcd95a3SBarry Smith 2344bcd95a3SBarry Smith ```console 2354bcd95a3SBarry Smith $ export FOO=1; export BAR=1; ./ex1 2364bcd95a3SBarry Smith ``` 2374bcd95a3SBarry Smith 2384bcd95a3SBarry Smith - Variables defined in an `env:` block are evaluated by the runscript in the order in 2394bcd95a3SBarry Smith which they are defined in the `TEST` block. Thus it is possible for later variables 2404bcd95a3SBarry Smith to refer to previously defined ones: 2414bcd95a3SBarry Smith 2424bcd95a3SBarry Smith ```yaml 2434bcd95a3SBarry Smith test: 2444bcd95a3SBarry Smith env: FOO='hello' BAR=${FOO} 2454bcd95a3SBarry Smith ``` 2464bcd95a3SBarry Smith 2474bcd95a3SBarry Smith results in 2484bcd95a3SBarry Smith 2494bcd95a3SBarry Smith ```console 2504bcd95a3SBarry Smith $ export FOO='hello'; export BAR=${FOO}; ./ex1 2514bcd95a3SBarry Smith # expanded by shell to 2524bcd95a3SBarry Smith $ export FOO='hello'; export BAR='hello'; ./ex1 2534bcd95a3SBarry Smith ``` 2544bcd95a3SBarry Smith 2554bcd95a3SBarry Smith Note this also implies that 2564bcd95a3SBarry Smith 2574bcd95a3SBarry Smith ```yaml 2584bcd95a3SBarry Smith test: 2594bcd95a3SBarry Smith env: FOO=1 FOO=0 2604bcd95a3SBarry Smith ``` 2614bcd95a3SBarry Smith 2624bcd95a3SBarry Smith results in 2634bcd95a3SBarry Smith 2644bcd95a3SBarry Smith ```console 2654bcd95a3SBarry Smith $ export FOO=1; export FOO=0; ./ex1 2664bcd95a3SBarry Smith ``` 2674bcd95a3SBarry Smith 2684bcd95a3SBarry Smith### Additional Specifications 2694bcd95a3SBarry Smith 2704bcd95a3SBarry SmithIn addition to the above keywords, other language features are 2714bcd95a3SBarry Smithsupported. 2724bcd95a3SBarry Smith 2734bcd95a3SBarry Smith- **for loops**: Specifying `{{list of values}}` will generate a loop over 2744bcd95a3SBarry Smith an enclosed space-delimited list of values. 2754bcd95a3SBarry Smith It is supported within `nsize` and `args`. For example, 2764bcd95a3SBarry Smith 2774bcd95a3SBarry Smith ``` 2784bcd95a3SBarry Smith nsize: {{1 2 4}} 2794bcd95a3SBarry Smith args: -matload_block_size {{2 3}shared output} 2804bcd95a3SBarry Smith ``` 2814bcd95a3SBarry Smith 2824bcd95a3SBarry Smith Here the output for each `-matload_block_size` value is assumed to be 2834bcd95a3SBarry Smith the same so that only one output file is needed. 2844bcd95a3SBarry Smith 2854bcd95a3SBarry Smith If the loop causes different output for each loop iteration, then `separate output` needs to be used: 2864bcd95a3SBarry Smith 2874bcd95a3SBarry Smith ``` 2884bcd95a3SBarry Smith args: -matload_block_size {{2 3}separate output} 2894bcd95a3SBarry Smith ``` 2904bcd95a3SBarry Smith 2914bcd95a3SBarry Smith In this case, each loop value generates a separate script, 2924bcd95a3SBarry Smith and uses a separate output file for comparison. 2934bcd95a3SBarry Smith 2944bcd95a3SBarry Smith Note that `{{...}}` is equivalent to `{{...}shared output}`. 2954bcd95a3SBarry Smith 2964bcd95a3SBarry Smith(sec_testing_error_testing)= 2974bcd95a3SBarry Smith 2984bcd95a3SBarry Smith### Testing Errors And Exceptional Code 2994bcd95a3SBarry Smith 3004bcd95a3SBarry SmithIt is possible (and encouraged!) to test error conditions within the test harness. Since 3014bcd95a3SBarry Smitherror messages produced by `SETERRQ()` and friends are not portable between systems, 3024bcd95a3SBarry Smithadditional arguments must be passed to tests to modify error handling, specifically: 3034bcd95a3SBarry Smith 3044bcd95a3SBarry Smith```yaml 3054bcd95a3SBarry Smithargs: -petsc_ci_portable_error_output -error_output_stdout 3064bcd95a3SBarry Smith``` 3074bcd95a3SBarry Smith 3084bcd95a3SBarry SmithThese arguments have the following effect: 3094bcd95a3SBarry Smith 3104bcd95a3SBarry Smith- `-petsc_ci_portable_error_output`: Strips system or configuration-specific information 3114bcd95a3SBarry Smith from error messages. Specifically this: 3124bcd95a3SBarry Smith 3134bcd95a3SBarry Smith - Removes all path components except the file name from the traceback 3144bcd95a3SBarry Smith - Removes line and column numbers from the traceback 3154bcd95a3SBarry Smith - Removes PETSc version information 3164bcd95a3SBarry Smith - Removes `configure` options used 3174bcd95a3SBarry Smith - Removes system name 3184bcd95a3SBarry Smith - Removes hostname 3194bcd95a3SBarry Smith - Removes date 3204bcd95a3SBarry Smith 3214bcd95a3SBarry Smith With this option error messages will be identical across systems, runs, and PETSc 3224bcd95a3SBarry Smith configurations (barring of course configurations in which the error is not raised). 3234bcd95a3SBarry Smith 3244bcd95a3SBarry Smith Furthermore, this option also changes the default behavior of the error handler to 3254bcd95a3SBarry Smith **gracefully** exit where possible. For single-ranked runs this means returning with 3264bcd95a3SBarry Smith exit-code `0` and calling `MPI_Finalize()` instead of `MPI_Abort()`. Multi-rank 3274bcd95a3SBarry Smith tests will call `MPI_Abort()` on errors raised on `PETSC_COMM_SELF`, but will call 3284bcd95a3SBarry Smith `MPI_Finalize()` otherwise. 3294bcd95a3SBarry Smith 3304bcd95a3SBarry Smith- `-error_output_stdout`: Forces `SETERRQ()` and friends to dump error messages to 3314bcd95a3SBarry Smith `stdout` instead of `stderr`. While using `stderr` (alongside the `Error:` 3324bcd95a3SBarry Smith sub-directive under `filter:`) also works it appears to be unstable under heavy 3334bcd95a3SBarry Smith load, especially in CI. 3344bcd95a3SBarry Smith 3354bcd95a3SBarry SmithUsing both options in tandem allows one to use the normal `output:` mechanism to compare 3364bcd95a3SBarry Smithexpected and actual error outputs. 3374bcd95a3SBarry Smith 3384bcd95a3SBarry SmithWhen writing ASCII output that may be not portable, so one wants `-petsc_ci_portable_error_output` to 3394bcd95a3SBarry Smithcause the output to be skipped, enclose the output with code such as 3404bcd95a3SBarry Smith 3414bcd95a3SBarry Smith``` 3424bcd95a3SBarry Smithif (!PetscCIEnabledPortableErrorOutput) 3434bcd95a3SBarry Smith``` 3444bcd95a3SBarry Smith 3454bcd95a3SBarry Smithto prevent it from being output when the CI test harness is running. 3464bcd95a3SBarry Smith 3474bcd95a3SBarry Smith### Test Block Examples 3484bcd95a3SBarry Smith 3494bcd95a3SBarry SmithThe following is the simplest test block: 3504bcd95a3SBarry Smith 3514bcd95a3SBarry Smith```yaml 3524bcd95a3SBarry Smith/*TEST 3534bcd95a3SBarry Smith test: 3544bcd95a3SBarry SmithTEST*/ 3554bcd95a3SBarry Smith``` 3564bcd95a3SBarry Smith 3574bcd95a3SBarry SmithIf this block is in `src/a/b/examples/tutorials/ex1.c`, then it will 3584bcd95a3SBarry Smithcreate `a_b_tutorials-ex1` test that requires only one 3594bcd95a3SBarry Smithprocess, with no arguments, and diff the resultant output with 3604bcd95a3SBarry Smith`src/a/b/examples/tutorials/output/ex1.out`. 3614bcd95a3SBarry Smith 3624bcd95a3SBarry SmithFor Fortran, the equivalent is 3634bcd95a3SBarry Smith 3644bcd95a3SBarry Smith```fortran 3654bcd95a3SBarry Smith!/*TEST 3664bcd95a3SBarry Smith! test: 3674bcd95a3SBarry Smith!TEST*/ 3684bcd95a3SBarry Smith``` 3694bcd95a3SBarry Smith 3704bcd95a3SBarry SmithA more complete example, showing just the lines between `/*TEST` and `TEST*/`: 3714bcd95a3SBarry Smith 3724bcd95a3SBarry Smith```yaml 3734bcd95a3SBarry Smithtest: 3744bcd95a3SBarry Smithtest: 3754bcd95a3SBarry Smith suffix: 1 3764bcd95a3SBarry Smith nsize: 2 3774bcd95a3SBarry Smith args: -t 2 -pc_type jacobi -ksp_monitor_short -ksp_type gmres 3784bcd95a3SBarry Smith args: -ksp_gmres_cgs_refinement_type refine_always -s2_ksp_type bcgs 3794bcd95a3SBarry Smith args: -s2_pc_type jacobi -s2_ksp_monitor_short 3804bcd95a3SBarry Smith requires: x 3814bcd95a3SBarry Smith``` 3824bcd95a3SBarry Smith 3834bcd95a3SBarry SmithThis creates two tests. Assuming that this is 3844bcd95a3SBarry Smith`src/a/b/examples/tutorials/ex1.c`, the tests would be 3854bcd95a3SBarry Smith`a_b_tutorials-ex1` and `a_b_tutorials-ex1_1`. 3864bcd95a3SBarry Smith 3874bcd95a3SBarry SmithFollowing is an example of how to test a permutation of arguments 3884bcd95a3SBarry Smithagainst the same output file: 3894bcd95a3SBarry Smith 3904bcd95a3SBarry Smith```yaml 3914bcd95a3SBarry Smithtestset: 3924bcd95a3SBarry Smith suffix: 19 3934bcd95a3SBarry Smith requires: datafilespath 3944bcd95a3SBarry Smith args: -f0 ${DATAFILESPATH}/matrices/poisson1 3954bcd95a3SBarry Smith args: -ksp_type cg -pc_type icc -pc_factor_levels 2 3964bcd95a3SBarry Smith test: 3974bcd95a3SBarry Smith test: 3984bcd95a3SBarry Smith args: -mat_type seqsbaij 3994bcd95a3SBarry Smith``` 4004bcd95a3SBarry Smith 4014bcd95a3SBarry SmithAssuming that this is `ex10.c`, there would be two mpiexec/diff 4024bcd95a3SBarry Smithinvocations in `runex10_19.sh`. 4034bcd95a3SBarry Smith 4044bcd95a3SBarry SmithHere is a similar example, but the permutation of arguments creates 4054bcd95a3SBarry Smithdifferent output: 4064bcd95a3SBarry Smith 4074bcd95a3SBarry Smith```yaml 4084bcd95a3SBarry Smithtestset: 4094bcd95a3SBarry Smith requires: datafilespath 4104bcd95a3SBarry Smith args: -f0 ${DATAFILESPATH}/matrices/medium 4114bcd95a3SBarry Smith args: -ksp_type bicg 4124bcd95a3SBarry Smith test: 4134bcd95a3SBarry Smith suffix: 4 4144bcd95a3SBarry Smith args: -pc_type lu 4154bcd95a3SBarry Smith test: 4164bcd95a3SBarry Smith suffix: 5 4174bcd95a3SBarry Smith``` 4184bcd95a3SBarry Smith 4194bcd95a3SBarry SmithAssuming that this is `ex10.c`, two shell scripts will be created: 4204bcd95a3SBarry Smith`runex10_4.sh` and `runex10_5.sh`. 4214bcd95a3SBarry Smith 4224bcd95a3SBarry SmithAn example using a for loop is: 4234bcd95a3SBarry Smith 4244bcd95a3SBarry Smith```yaml 4254bcd95a3SBarry Smithtestset: 4264bcd95a3SBarry Smith suffix: 1 4274bcd95a3SBarry Smith args: -f ${DATAFILESPATH}/matrices/small -mat_type aij 4284bcd95a3SBarry Smith requires: datafilespath 4294bcd95a3SBarry Smithtestset: 4304bcd95a3SBarry Smith suffix: 2 4314bcd95a3SBarry Smith output_file: output/ex138_1.out 4324bcd95a3SBarry Smith args: -f ${DATAFILESPATH}/matrices/small 4334bcd95a3SBarry Smith args: -mat_type baij -matload_block_size {{2 3}shared output} 4344bcd95a3SBarry Smith requires: datafilespath 4354bcd95a3SBarry Smith``` 4364bcd95a3SBarry Smith 4374bcd95a3SBarry SmithIn this example, `ex138_2` will invoke `runex138_2.sh` twice with 4384bcd95a3SBarry Smithtwo different arguments, but both are diffed with the same file. 4394bcd95a3SBarry Smith 4404bcd95a3SBarry SmithFollowing is an example showing the hierarchical nature of the test 4414bcd95a3SBarry Smithspecification. 4424bcd95a3SBarry Smith 4434bcd95a3SBarry Smith```yaml 4444bcd95a3SBarry Smithtestset: 4454bcd95a3SBarry Smith suffix:2 4464bcd95a3SBarry Smith output_file: output/ex138_1.out 4474bcd95a3SBarry Smith args: -f ${DATAFILESPATH}/matrices/small -mat_type baij 4484bcd95a3SBarry Smith test: 4494bcd95a3SBarry Smith args: -matload_block_size 2 4504bcd95a3SBarry Smith test: 4514bcd95a3SBarry Smith args: -matload_block_size 3 4524bcd95a3SBarry Smith``` 4534bcd95a3SBarry Smith 4544bcd95a3SBarry SmithThis is functionally equivalent to the for loop shown above. 4554bcd95a3SBarry Smith 4564bcd95a3SBarry SmithHere is a more complex example using for loops: 4574bcd95a3SBarry Smith 4584bcd95a3SBarry Smith```yaml 4594bcd95a3SBarry Smithtestset: 4604bcd95a3SBarry Smith suffix: 19 4614bcd95a3SBarry Smith requires: datafilespath 4624bcd95a3SBarry Smith args: -f0 ${DATAFILESPATH}/matrices/poisson1 4634bcd95a3SBarry Smith args: -ksp_type cg -pc_type icc 4644bcd95a3SBarry Smith args: -pc_factor_levels {{0 2 4}separate output} 4654bcd95a3SBarry Smith test: 4664bcd95a3SBarry Smith test: 4674bcd95a3SBarry Smith args: -mat_type seqsbaij 4684bcd95a3SBarry Smith``` 4694bcd95a3SBarry Smith 4704bcd95a3SBarry SmithIf this is in `ex10.c`, then the shell scripts generated would be 4714bcd95a3SBarry Smith 4724bcd95a3SBarry Smith- `runex10_19_pc_factor_levels-0.sh` 4734bcd95a3SBarry Smith- `runex10_19_pc_factor_levels-2.sh` 4744bcd95a3SBarry Smith- `runex10_19_pc_factor_levels-4.sh` 4754bcd95a3SBarry Smith 4764bcd95a3SBarry SmithEach shell script would invoke twice. 4774bcd95a3SBarry Smith 4784bcd95a3SBarry Smith### Build Language Options 4794bcd95a3SBarry Smith 4804bcd95a3SBarry SmithYou can specify issues related to the compilation of the source file 4814bcd95a3SBarry Smithwith the `build:` block. The language is as follows. 4824bcd95a3SBarry Smith 4834bcd95a3SBarry Smith- **requires:** (*Optional*; *Default:* `""`) 4844bcd95a3SBarry Smith 4854bcd95a3SBarry Smith - Same as the runtime requirements (for example, can include 4864bcd95a3SBarry Smith `requires: fftw`) but also requirements related to types: 4874bcd95a3SBarry Smith 4884bcd95a3SBarry Smith 1. Precision types: `single`, `double`, `quad`, `int32` 4894bcd95a3SBarry Smith 2. Scalar types: `complex` (and `!complex`) 4904bcd95a3SBarry Smith 4914bcd95a3SBarry Smith - In addition, `TODO` is available to allow you to skip the build 4924bcd95a3SBarry Smith of this file but still maintain it in the source tree. 4934bcd95a3SBarry Smith 4944bcd95a3SBarry Smith- **depends:** (*Optional*; *Default:* `""`) 4954bcd95a3SBarry Smith 4964bcd95a3SBarry Smith - List any dependencies required to compile the file 4974bcd95a3SBarry Smith 4984bcd95a3SBarry SmithA typical example for compiling for only real numbers is 4994bcd95a3SBarry Smith 5004bcd95a3SBarry Smith``` 5014bcd95a3SBarry Smith/*TEST 5024bcd95a3SBarry Smith build: 5034bcd95a3SBarry Smith requires: !complex 5044bcd95a3SBarry Smith test: 5054bcd95a3SBarry SmithTEST*/ 5064bcd95a3SBarry Smith``` 5074bcd95a3SBarry Smith 5084bcd95a3SBarry Smith## Running the tests 5094bcd95a3SBarry Smith 5104bcd95a3SBarry SmithThe make rules for running tests are contained in `gmakefile.test` in the PETSc root directory. They can usually be accessed by 5114bcd95a3SBarry Smithsimply using commands such as 5124bcd95a3SBarry Smith 5134bcd95a3SBarry Smith```console 5144bcd95a3SBarry Smith$ make test 5154bcd95a3SBarry Smith``` 5164bcd95a3SBarry Smith 5174bcd95a3SBarry Smithor, for a list of test options, 5184bcd95a3SBarry Smith 5194bcd95a3SBarry Smith```console 5204bcd95a3SBarry Smith$ make help-test 5214bcd95a3SBarry Smith``` 5224bcd95a3SBarry Smith 5234bcd95a3SBarry Smith### Determining the failed jobs of a given run 5244bcd95a3SBarry Smith 5254bcd95a3SBarry SmithThe running of the test harness will show which tests fail, but you may not have 5264bcd95a3SBarry Smithlogged the output or run without showing the full error. The best way of 5274bcd95a3SBarry Smithexamining the errors is with this command: 5284bcd95a3SBarry Smith 5294bcd95a3SBarry Smith```console 5304bcd95a3SBarry Smith$ $EDITOR $PETSC_DIR/$PETSC_ARCH/tests/test*err.log 5314bcd95a3SBarry Smith``` 5324bcd95a3SBarry Smith 5334bcd95a3SBarry SmithThis method can also be used for the PETSc continuous integration (CI) pipeline jobs. For failed jobs you can download the 5344bcd95a3SBarry Smithlog files from the `artifacts download` tab on the right side: 5354bcd95a3SBarry Smith 5364bcd95a3SBarry Smith:::{figure} /images/developers/test-artifacts.png 5374bcd95a3SBarry Smith:alt: Test Artifacts at Gitlab 5384bcd95a3SBarry Smith 5394bcd95a3SBarry SmithTest artifacts can be downloaded from GitLab. 5404bcd95a3SBarry Smith::: 5414bcd95a3SBarry Smith 5424bcd95a3SBarry SmithTo see the list of all tests that failed from the last run, you can also run this command: 5434bcd95a3SBarry Smith 5444bcd95a3SBarry Smith```console 5454bcd95a3SBarry Smith$ make print-test test-fail=1 5464bcd95a3SBarry Smith``` 5474bcd95a3SBarry Smith 5484bcd95a3SBarry SmithTo print it out in a column format: 5494bcd95a3SBarry Smith 5504bcd95a3SBarry Smith```console 5514bcd95a3SBarry Smith$ make print-test test-fail=1 | tr ' ' '\n' | sort 5524bcd95a3SBarry Smith``` 5534bcd95a3SBarry Smith 5544bcd95a3SBarry SmithOnce you know which tests failed, the question is how to debug them. 5554bcd95a3SBarry Smith 5564bcd95a3SBarry Smith### Introduction to debugging workflows 5574bcd95a3SBarry Smith 5584bcd95a3SBarry SmithHere, two different workflows on developing with the test harness are presented, 5594bcd95a3SBarry Smithand then the language for adding a new test is described. Before describing the 5604bcd95a3SBarry Smithworkflow, we first discuss the output of the test harness and how it maps onto 5614bcd95a3SBarry Smithmakefile targets and shell scripts. 5624bcd95a3SBarry Smith 5634bcd95a3SBarry SmithConsider this line from running the PETSc test system: 5644bcd95a3SBarry Smith 5654bcd95a3SBarry Smith``` 5664bcd95a3SBarry SmithTEST arch-ci-linux-uni-pkgs/tests/counts/vec_is_sf_tests-ex1_basic_1.counts 5674bcd95a3SBarry Smith``` 5684bcd95a3SBarry Smith 5694bcd95a3SBarry SmithThe string `vec_is_sf_tests-ex1_basic_1` gives the following information: 5704bcd95a3SBarry Smith 5714bcd95a3SBarry Smith- The file generating the tests is found in `$PETSC_DIR/src/vec/is/sf/tests/ex1.c` 5724bcd95a3SBarry Smith- The makefile target for the *test* is `vec_is_sf_tests-ex1_basic_1` 5734bcd95a3SBarry Smith- The makefile target for the *executable* is `$PETSC_ARCH/tests/vec/is/sf/tests/ex1` 5744bcd95a3SBarry Smith- The shell script running the test is located at: `$PETSC_DIR/$PETSC_ARCH/tests/vec/is/sf/tests/runex1_basic_1.sh` 5754bcd95a3SBarry Smith 5764bcd95a3SBarry SmithLet's say that you want to debug a single test as part of development. There 5774bcd95a3SBarry Smithare two basic methods of doing this: 1) use shell script directly in test 5784bcd95a3SBarry Smithdirectory, or 2) use the gmakefile.test from the top level directory. We present both 5794bcd95a3SBarry Smithworkflows. 5804bcd95a3SBarry Smith 5814bcd95a3SBarry Smith### Debugging a test using shell the generated scripts 5824bcd95a3SBarry Smith 5834bcd95a3SBarry SmithFirst, look at the working directory and the options for the 5844bcd95a3SBarry Smithscripts: 5854bcd95a3SBarry Smith 5864bcd95a3SBarry Smith```console 5874bcd95a3SBarry Smith$ cd $PETSC_ARCH/tests/vec/is/sf/tests 5884bcd95a3SBarry Smith$ ./runex1_basic_1.sh -h 5894bcd95a3SBarry SmithUsage: ./runex1_basic_1.sh [options] 5904bcd95a3SBarry Smith 5914bcd95a3SBarry SmithOPTIONS 5924bcd95a3SBarry Smith -a <args> ......... Override default arguments 5934bcd95a3SBarry Smith -c ................ Cleanup (remove generated files) 5944bcd95a3SBarry Smith -C ................ Compile 5954bcd95a3SBarry Smith -d ................ Launch in debugger 5964bcd95a3SBarry Smith -e <args> ......... Add extra arguments to default 5974bcd95a3SBarry Smith -f ................ force attempt to run test that would otherwise be skipped 5984bcd95a3SBarry Smith -h ................ help: print this message 5994bcd95a3SBarry Smith -n <integer> ...... Override the number of processors to use 6004bcd95a3SBarry Smith -j ................ Pass -j to petscdiff (just use diff) 6014bcd95a3SBarry Smith -J <arg> .......... Pass -J to petscdiff (just use diff with arg) 6024bcd95a3SBarry Smith -m ................ Update results using petscdiff 6034bcd95a3SBarry Smith -M ................ Update alt files using petscdiff 6044bcd95a3SBarry Smith -o <arg> .......... Output format: 'interactive', 'err_only' 6054bcd95a3SBarry Smith -p ................ Print command: Print first command and exit 6064bcd95a3SBarry Smith -t ................ Override the default timeout (default=60 sec) 6074bcd95a3SBarry Smith -U ................ run cUda-memcheck 6084bcd95a3SBarry Smith -V ................ run Valgrind 6094bcd95a3SBarry Smith -v ................ Verbose: Print commands 6104bcd95a3SBarry Smith``` 6114bcd95a3SBarry Smith 6124bcd95a3SBarry SmithWe will be using the `-C`, `-V`, and `-p` flags. 6134bcd95a3SBarry Smith 6144bcd95a3SBarry SmithA basic workflow is something similar to: 6154bcd95a3SBarry Smith 6164bcd95a3SBarry Smith```console 6174bcd95a3SBarry Smith$ <edit> 6184bcd95a3SBarry Smith$ runex1_basic_1.sh -C 6194bcd95a3SBarry Smith$ <edit> 6204bcd95a3SBarry Smith$ ... 6214bcd95a3SBarry Smith$ runex1_basic_1.sh -m # If need to update results 6224bcd95a3SBarry Smith$ ... 6234bcd95a3SBarry Smith$ runex1_basic_1.sh -V # Make sure valgrind clean 6244bcd95a3SBarry Smith$ cd $PETSC_DIR 6254bcd95a3SBarry Smith$ git commit -a 6264bcd95a3SBarry Smith``` 6274bcd95a3SBarry Smith 6284bcd95a3SBarry SmithFor loops it sometimes can become onerous to run the whole test. 6294bcd95a3SBarry SmithIn this case, you can use the `-p` flag to print just the first 6304bcd95a3SBarry Smithcommand. It will print a command suitable for running from 6314bcd95a3SBarry Smith`$PETSC_DIR`, but it is easy to modify for execution in the test 6324bcd95a3SBarry Smithdirectory: 6334bcd95a3SBarry Smith 6344bcd95a3SBarry Smith```console 6354bcd95a3SBarry Smith$ runex1_basic_1.sh -p 6364bcd95a3SBarry Smith``` 6374bcd95a3SBarry Smith 6384bcd95a3SBarry Smith### Debugging a PETSc test using the gmakefile.test 6394bcd95a3SBarry Smith 6404bcd95a3SBarry SmithFirst recall how to find help for the options: 6414bcd95a3SBarry Smith 6424bcd95a3SBarry Smith```console 6434bcd95a3SBarry Smith$ make help-test 6444c2e35b6SJunchao ZhangTest usage: 6454c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test <options> 6464c2e35b6SJunchao Zhang 6474c2e35b6SJunchao ZhangOptions: 6484c2e35b6SJunchao Zhang NO_RM=1 Do not remove the executables after running 6494c2e35b6SJunchao Zhang REPLACE=1 Replace the output in PETSC_DIR source tree (-m to test scripts) 6504c2e35b6SJunchao Zhang OUTPUT=1 Show only the errors on stdout 6514c2e35b6SJunchao Zhang ALT=1 Replace 'alt' output in PETSC_DIR source tree (-M to test scripts) 6524c2e35b6SJunchao Zhang DIFF_NUMBERS=1 Diff the numbers in the output (-j to test scripts and petscdiff) 653*74df5e01SJunchao Zhang CUDAMEMCHECK=1 Execute the tests using CUDA "compute-sanitizer --tool memcheck" (-U to test scripts) 6544c2e35b6SJunchao Zhang Use PETSC_CUDAMEMCHECK_COMMAND to change the executable to run and 6554c2e35b6SJunchao Zhang PETSC_CUDAMEMCHECK_ARGS to change the arguments (note: both 6564c2e35b6SJunchao Zhang cuda-memcheck and compute-sanitizer are supported) 6574c2e35b6SJunchao Zhang VALGRIND=1 Execute the tests using valgrind (-V to test scripts) 6584c2e35b6SJunchao Zhang DEBUG=1 Launch tests in the debugger (-d to the scripts) 6594c2e35b6SJunchao Zhang NP=<num proc> Set a number of processors to pass to scripts. 6604c2e35b6SJunchao Zhang FORCE=1 Force SKIP or TODO tests to run 6614c2e35b6SJunchao Zhang PRINTONLY=1 Print the command, but do not run. For loops print first command 6624c2e35b6SJunchao Zhang TIMEOUT=<time> Test timeout limit in seconds (default in config/petsc_harness.sh) 6634c2e35b6SJunchao Zhang TESTDIR='tests' Subdirectory where tests are run ($PETSC_DIR/$PETSC_ARCH 6644c2e35b6SJunchao Zhang or / 6654c2e35b6SJunchao Zhang or /share/petsc/examples/) 6664c2e35b6SJunchao Zhang TESTBASE='tests' Subdirectory where tests are run ($PETSC_DIR/$PETSC_ARCH) 6674c2e35b6SJunchao Zhang OPTIONS='<args>' Override options to scripts (-a to test scripts) 6684c2e35b6SJunchao Zhang EXTRA_OPTIONS='<args>' Add options to scripts (-e to test scripts) 6694c2e35b6SJunchao Zhang 6704c2e35b6SJunchao ZhangSpecial options for macOS: 6714c2e35b6SJunchao Zhang MACOS_FIREWALL=1 Add each built test to the macOS firewall list to prevent popups. Configure --with-macos-firewall-rules to make this default 6724c2e35b6SJunchao Zhang 6734c2e35b6SJunchao ZhangTests can be generated by searching with multiple methods 6744c2e35b6SJunchao Zhang For general searching (using config/query_tests.py): 6754c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test search='sys*ex2*' 6764c2e35b6SJunchao Zhang or the shortcut using s 6774c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test s='sys*ex2*' 6784c2e35b6SJunchao Zhang You can also use the full path to a file directory 6794c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test s='src/sys/tests/' 6804c2e35b6SJunchao Zhang or a file 6814c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test s='src/sys/tests/ex1.c' 6824c2e35b6SJunchao Zhang 6834c2e35b6SJunchao Zhang To search for fields from the original test definitions: 6844c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test query='requires' queryval='*MPI_PROCESS_SHARED_MEMORY*' 6854c2e35b6SJunchao Zhang or the shortcut using q and qv 6864c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test q='requires' qv='*MPI_PROCESS_SHARED_MEMORY*' 6874c2e35b6SJunchao Zhang To filter results from other searches, use searchin 6884c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test s='src/sys/tests/' searchin='*options*' 6894c2e35b6SJunchao Zhang 6904c2e35b6SJunchao Zhang To re-run the last tests which failed: 6914c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory test test-fail='1' 6924c2e35b6SJunchao Zhang 6934c2e35b6SJunchao Zhang To see which targets match a given pattern (useful for doing a specific target): 6944c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory print-test search=sys* 6954c2e35b6SJunchao Zhang 6964c2e35b6SJunchao Zhang To build an executable, give full path to location: 6974c2e35b6SJunchao Zhang /usr/bin/gmake --no-print-directory ${PETSC_ARCH}/tests/sys/tests/ex1 6984c2e35b6SJunchao Zhang or make the test with NO_RM=1 6994bcd95a3SBarry Smith``` 7004bcd95a3SBarry Smith 7014bcd95a3SBarry SmithTo compile the test and run it: 7024bcd95a3SBarry Smith 7034bcd95a3SBarry Smith```console 7044bcd95a3SBarry Smith$ make test search=vec_is_sf_tests-ex1_basic_1 7054bcd95a3SBarry Smith``` 7064bcd95a3SBarry Smith 7074bcd95a3SBarry SmithThis can consist of your basic workflow. However, 7084bcd95a3SBarry Smithfor the normal compile and edit, running the entire harness with search can be 7094bcd95a3SBarry Smithcumbersome. So first get the command: 7104bcd95a3SBarry Smith 7114bcd95a3SBarry Smith```console 7124bcd95a3SBarry Smith$ make vec_is_sf_tests-ex1_basic_1 PRINTONLY=1 7134bcd95a3SBarry Smith<copy command> 7144bcd95a3SBarry Smith<edit> 7154bcd95a3SBarry Smith$ make $PETSC_ARCH/tests/vec/is/sf/tests/ex1 7164bcd95a3SBarry Smith$ /scratch/kruger/contrib/petsc-mpich-cxx/bin/mpiexec -n 1 arch-mpich-cxx-py3/tests/vec/is/sf/tests/ex1 7174bcd95a3SBarry Smith... 7184bcd95a3SBarry Smith$ cd $PETSC_DIR 7194bcd95a3SBarry Smith$ git commit -a 7204bcd95a3SBarry Smith``` 7214bcd95a3SBarry Smith 7224bcd95a3SBarry Smith### Advanced searching 7234bcd95a3SBarry Smith 7244bcd95a3SBarry SmithFor forming a search, it is recommended to always use `print-test` instead of 7254bcd95a3SBarry Smith`test` to make sure it is returning the values that you want. 7264bcd95a3SBarry Smith 7274bcd95a3SBarry SmithThe three basic and recommended arguments are: 7284bcd95a3SBarry Smith 7294bcd95a3SBarry Smith- `search` (or `s`) 7304bcd95a3SBarry Smith 7314bcd95a3SBarry Smith - Searches based on name of test target (see above) 7324bcd95a3SBarry Smith 7334bcd95a3SBarry Smith - Use the familiar glob syntax (like the Unix `ls` command). Example: 7344bcd95a3SBarry Smith 7354bcd95a3SBarry Smith ```console 7364bcd95a3SBarry Smith $ make print-test search='vec_is*ex1*basic*1' 7374bcd95a3SBarry Smith ``` 7384bcd95a3SBarry Smith 7394bcd95a3SBarry Smith Equivalently: 7404bcd95a3SBarry Smith 7414bcd95a3SBarry Smith ```console 7424bcd95a3SBarry Smith $ make print-test s='vec_is*ex1*basic*1' 7434bcd95a3SBarry Smith ``` 7444bcd95a3SBarry Smith 7454bcd95a3SBarry Smith - It also takes full paths. Examples: 7464bcd95a3SBarry Smith 7474bcd95a3SBarry Smith ```console 7484bcd95a3SBarry Smith $ make print-test s='src/vec/is/tests/ex1.c' 7494bcd95a3SBarry Smith ``` 7504bcd95a3SBarry Smith 7514bcd95a3SBarry Smith ```console 7524bcd95a3SBarry Smith $ make print-test s='src/dm/impls/plex/tests/' 7534bcd95a3SBarry Smith ``` 7544bcd95a3SBarry Smith 7554bcd95a3SBarry Smith ```console 7564bcd95a3SBarry Smith $ make print-test s='src/dm/impls/plex/tests/ex1.c' 7574bcd95a3SBarry Smith ``` 7584bcd95a3SBarry Smith 7594bcd95a3SBarry Smith- `query` and `queryval` (or `q` and `qv`) 7604bcd95a3SBarry Smith 7614bcd95a3SBarry Smith - `query` corresponds to test harness keyword, `queryval` to the value. Example: 7624bcd95a3SBarry Smith 7634bcd95a3SBarry Smith ```console 7644bcd95a3SBarry Smith $ make print-test query='suffix' queryval='basic_1' 7654bcd95a3SBarry Smith ``` 7664bcd95a3SBarry Smith 7674bcd95a3SBarry Smith - Invokes `config/query_tests.py` to query the tests (see 7684bcd95a3SBarry Smith `config/query_tests.py --help` for more information). 7694bcd95a3SBarry Smith 7704bcd95a3SBarry Smith - See below for how to use as it has many features 7714bcd95a3SBarry Smith 7724bcd95a3SBarry Smith- `searchin` (or `i`) 7734bcd95a3SBarry Smith 7744bcd95a3SBarry Smith - Filters results of above searches. Example: 7754bcd95a3SBarry Smith 7764bcd95a3SBarry Smith ```console 7774bcd95a3SBarry Smith $ make print-test s='src/dm/impls/plex/tests/ex1.c' i='*refine_overlap_2d*' 7784bcd95a3SBarry Smith ``` 7794bcd95a3SBarry Smith 7804bcd95a3SBarry SmithSearching using GNU make's native regexp functionality is kept for people who like it, but most developers will likely prefer the above methods: 7814bcd95a3SBarry Smith 7824bcd95a3SBarry Smith- `gmakesearch` 7834bcd95a3SBarry Smith 7844bcd95a3SBarry Smith - Use GNU make's own filter capability. 7854bcd95a3SBarry Smith 7864bcd95a3SBarry Smith - Fast, but requires knowing GNU make regex syntax which uses `%` instead of `*` 7874bcd95a3SBarry Smith 7884bcd95a3SBarry Smith - Also very limited (cannot use two `%`'s for example) 7894bcd95a3SBarry Smith 7904bcd95a3SBarry Smith - Example: 7914bcd95a3SBarry Smith 7924bcd95a3SBarry Smith ```console 7934bcd95a3SBarry Smith $ make test gmakesearch='vec_is%ex1_basic_1' 7944bcd95a3SBarry Smith ``` 7954bcd95a3SBarry Smith 7964bcd95a3SBarry Smith- `gmakesearchin` 7974bcd95a3SBarry Smith 7984bcd95a3SBarry Smith - Use GNU make's own filter capability to search in previous results. Example: 7994bcd95a3SBarry Smith 8004bcd95a3SBarry Smith ```console 8014bcd95a3SBarry Smith $ make test gmakesearch='vec_is%1' gmakesearchin='basic' 8024bcd95a3SBarry Smith ``` 8034bcd95a3SBarry Smith 8044bcd95a3SBarry Smith### Query-based searching 8054bcd95a3SBarry Smith 8064bcd95a3SBarry SmithNote the use of glob style matching is also accepted in the value field: 8074bcd95a3SBarry Smith 8084bcd95a3SBarry Smith```console 8094bcd95a3SBarry Smith$ make print-test query='suffix' queryval='basic_1' 8104bcd95a3SBarry Smith``` 8114bcd95a3SBarry Smith 8124bcd95a3SBarry Smith```console 8134bcd95a3SBarry Smith$ make print-test query='requires' queryval='cuda' 8144bcd95a3SBarry Smith``` 8154bcd95a3SBarry Smith 8164bcd95a3SBarry Smith```console 8174bcd95a3SBarry Smith$ make print-test query='requires' queryval='defined(PETSC_HAVE_MPI_GPU_AWARE)' 8184bcd95a3SBarry Smith``` 8194bcd95a3SBarry Smith 8204bcd95a3SBarry Smith```console 8214bcd95a3SBarry Smith$ make print-test query='requires' queryval='*GPU_AWARE*' 8224bcd95a3SBarry Smith``` 8234bcd95a3SBarry Smith 8244bcd95a3SBarry SmithUsing the `name` field is equivalent to the search above: 8254bcd95a3SBarry Smith 8264bcd95a3SBarry Smith- Example: 8274bcd95a3SBarry Smith 8284bcd95a3SBarry Smith ```console 8294bcd95a3SBarry Smith $ make print-test query='name' queryval='vec_is*ex1*basic*1' 8304bcd95a3SBarry Smith ``` 8314bcd95a3SBarry Smith 8324bcd95a3SBarry Smith- This can be combined with union/intersect queries as discussed below 8334bcd95a3SBarry Smith 8344bcd95a3SBarry SmithArguments are tricky to search for. Consider 8354bcd95a3SBarry Smith 8364bcd95a3SBarry Smith```none 8374bcd95a3SBarry Smithargs: -ksp_monitor_short -pc_type ml -ksp_max_it 3 8384bcd95a3SBarry Smith``` 8394bcd95a3SBarry Smith 8404bcd95a3SBarry SmithSearch terms are 8414bcd95a3SBarry Smith 8424bcd95a3SBarry Smith```none 8434bcd95a3SBarry Smithksp_monitor, pc_type ml, ksp_max_it 8444bcd95a3SBarry Smith``` 8454bcd95a3SBarry Smith 8464bcd95a3SBarry SmithCertain items are ignored: 8474bcd95a3SBarry Smith 8484bcd95a3SBarry Smith- Numbers (see `ksp_max_it` above), but floats are ignored as well. 8494bcd95a3SBarry Smith- Loops: `args: -pc_fieldsplit_diag_use_amat {{0 1}}` gives `pc_fieldsplit_diag_use_amat` as the search term 8504bcd95a3SBarry Smith- Input files: `-f *` 8514bcd95a3SBarry Smith 8524bcd95a3SBarry SmithExamples of argument searching: 8534bcd95a3SBarry Smith 8544bcd95a3SBarry Smith```console 8554bcd95a3SBarry Smith$ make print-test query='args' queryval='ksp_monitor' 8564bcd95a3SBarry Smith``` 8574bcd95a3SBarry Smith 8584bcd95a3SBarry Smith```console 8594bcd95a3SBarry Smith$ make print-test query='args' queryval='*monitor*' 8604bcd95a3SBarry Smith``` 8614bcd95a3SBarry Smith 8624bcd95a3SBarry Smith```console 8634bcd95a3SBarry Smith$ make print-test query='args' queryval='pc_type ml' 8644bcd95a3SBarry Smith``` 8654bcd95a3SBarry Smith 8664bcd95a3SBarry SmithMultiple simultaneous queries can be performed with union (`,`), and intersection 8674bcd95a3SBarry Smith(`|`) operators in the `query` field. One may also use their alternate spellings 8684bcd95a3SBarry Smith(`%AND%` and `%OR%` respectively). The alternate spellings are useful in cases where 8694bcd95a3SBarry Smithone cannot avoid (possibly multiple) shell expansions that might otherwise interpret the 8704bcd95a3SBarry Smith`|` operator as a shell pipe. Examples: 8714bcd95a3SBarry Smith 8724bcd95a3SBarry Smith- All examples using `cuda` and all examples using `hip`: 8734bcd95a3SBarry Smith 8744bcd95a3SBarry Smith ```console 8754bcd95a3SBarry Smith $ make print-test query='requires,requires' queryval='cuda,hip' 8764bcd95a3SBarry Smith # equivalently 8774bcd95a3SBarry Smith $ make print-test query='requires%AND%requires' queryval='cuda%AND%hip' 8784bcd95a3SBarry Smith ``` 8794bcd95a3SBarry Smith 8804bcd95a3SBarry Smith- Examples that require both triangle and ctetgen (intersection of tests) 8814bcd95a3SBarry Smith 8824bcd95a3SBarry Smith ```console 8834bcd95a3SBarry Smith $ make print-test query='requires|requires' queryval='ctetgen,triangle' 8844bcd95a3SBarry Smith # equivalently 8854bcd95a3SBarry Smith $ make print-test query='requires%OR%requires' queryval='ctetgen%AND%triangle' 8864bcd95a3SBarry Smith ``` 8874bcd95a3SBarry Smith 8884bcd95a3SBarry Smith- Tests that require either `ctetgen` or `triangle` 8894bcd95a3SBarry Smith 8904bcd95a3SBarry Smith ```console 8914bcd95a3SBarry Smith $ make print-test query='requires,requires' queryval='ctetgen,triangle' 8924bcd95a3SBarry Smith # equivalently 8934bcd95a3SBarry Smith $ make print-test query='requires%AND%requires' queryval='ctetgen%AND%triangle' 8944bcd95a3SBarry Smith ``` 8954bcd95a3SBarry Smith 8964bcd95a3SBarry Smith- Find `cuda` examples in the `dm` package. 8974bcd95a3SBarry Smith 8984bcd95a3SBarry Smith ```console 8994bcd95a3SBarry Smith $ make print-test query='requires|name' queryval='cuda,dm*' 9004bcd95a3SBarry Smith # equivalently 9014bcd95a3SBarry Smith $ make print-test query='requires%OR%name' queryval='cuda%AND%dm*' 9024bcd95a3SBarry Smith ``` 9034bcd95a3SBarry Smith 9044bcd95a3SBarry SmithHere is a way of getting a feel for how the union and intersect operators work: 9054bcd95a3SBarry Smith 9064bcd95a3SBarry Smith```console 9074bcd95a3SBarry Smith$ make print-test query='requires' queryval='ctetgen' | tr ' ' '\n' | wc -l 9084bcd95a3SBarry Smith170 9094bcd95a3SBarry Smith$ make print-test query='requires' queryval='triangle' | tr ' ' '\n' | wc -l 9104bcd95a3SBarry Smith330 9114bcd95a3SBarry Smith$ make print-test query='requires,requires' queryval='ctetgen,triangle' | tr ' ' '\n' | wc -l 9124bcd95a3SBarry Smith478 9134bcd95a3SBarry Smith$ make print-test query='requires|requires' queryval='ctetgen,triangle' | tr ' ' '\n' | wc -l 9144bcd95a3SBarry Smith22 9154bcd95a3SBarry Smith``` 9164bcd95a3SBarry Smith 9174bcd95a3SBarry SmithThe total number of tests for running only ctetgen or triangle is 500. They have 22 tests in common, and 478 that 9184bcd95a3SBarry Smithrun independently of each other. 9194bcd95a3SBarry Smith 9204bcd95a3SBarry SmithThe union and intersection have fixed grouping. So this string argument 9214bcd95a3SBarry Smith 9224bcd95a3SBarry Smith```none 9234bcd95a3SBarry Smithquery='requires,requires|args' queryval='cuda,hip,*log*' 9244bcd95a3SBarry Smith# equivalently 9254bcd95a3SBarry Smithquery='requires%AND%requires%OR%args' queryval='cuda%AND%hip%AND%*log*' 9264bcd95a3SBarry Smith``` 9274bcd95a3SBarry Smith 9284bcd95a3SBarry Smithwill can be read as 9294bcd95a3SBarry Smith 9304bcd95a3SBarry Smith```none 9314bcd95a3SBarry Smithrequires:cuda && (requires:hip || args:*log*) 9324bcd95a3SBarry Smith``` 9334bcd95a3SBarry Smith 9344bcd95a3SBarry Smithwhich is probably not what is intended. 9354bcd95a3SBarry Smith 9364bcd95a3SBarry Smith`query/queryval` also support negation (`!`, alternate `%NEG%`), but is limited. 9374bcd95a3SBarry SmithThe negation only applies to tests that have a related field in it. So for example, the 9384bcd95a3SBarry Smitharguments of 9394bcd95a3SBarry Smith 9404bcd95a3SBarry Smith```console 9414bcd95a3SBarry Smithquery=requires queryval='!cuda' 9424bcd95a3SBarry Smith# equivalently 9434bcd95a3SBarry Smithquery=requires queryval='%NEG%cuda' 9444bcd95a3SBarry Smith``` 9454bcd95a3SBarry Smith 9464bcd95a3SBarry Smithwill only match if they explicitly have: 9474bcd95a3SBarry Smith 9484bcd95a3SBarry Smith``` 9494bcd95a3SBarry Smithrequires: !cuda 9504bcd95a3SBarry Smith``` 9514bcd95a3SBarry Smith 9524bcd95a3SBarry SmithIt does not match all cases that do not require cuda. 9534bcd95a3SBarry Smith 9544bcd95a3SBarry Smith### Debugging for loops 9554bcd95a3SBarry Smith 9564bcd95a3SBarry SmithOne of the more difficult issues is how to debug for loops when a subset of the 9574bcd95a3SBarry Smitharguments are the ones that cause a code crash. The default naming scheme is 9584bcd95a3SBarry Smithnot always helpful for figuring out the argument combination. 9594bcd95a3SBarry Smith 9604bcd95a3SBarry SmithFor example: 9614bcd95a3SBarry Smith 9624bcd95a3SBarry Smith```console 9634bcd95a3SBarry Smith$ make test s='src/ksp/ksp/tests/ex9.c' i='*1' 9644bcd95a3SBarry SmithUsing MAKEFLAGS: i=*1 s=src/ksp/ksp/tests/ex9.c 9654bcd95a3SBarry Smith TEST arch-osx-pkgs-opt-new/tests/counts/ksp_ksp_tests-ex9_1.counts 9664bcd95a3SBarry Smith ok ksp_ksp_tests-ex9_1+pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_type-additive 9674bcd95a3SBarry Smith not ok diff-ksp_ksp_tests-ex9_1+pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_type-additive 9684bcd95a3SBarry Smith ok ksp_ksp_tests-ex9_1+pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_type-multiplicative 9694bcd95a3SBarry Smith ... 9704bcd95a3SBarry Smith``` 9714bcd95a3SBarry Smith 9724bcd95a3SBarry SmithIn this case, the trick is to use the verbose option, `V=1` (or for the shell script workflows, `-v`) to have it show the commands: 9734bcd95a3SBarry Smith 9744bcd95a3SBarry Smith```console 9754bcd95a3SBarry Smith$ make test s='src/ksp/ksp/tests/ex9.c' i='*1' V=1 9764bcd95a3SBarry SmithUsing MAKEFLAGS: V=1 i=*1 s=src/ksp/ksp/tests/ex9.c 9774bcd95a3SBarry Smitharch-osx-pkgs-opt-new/tests/ksp/ksp/tests/runex9_1.sh -v 9784bcd95a3SBarry Smith ok ksp_ksp_tests-ex9_1+pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_diag_use_amat-0_pc_fieldsplit_type-additive # mpiexec -n 1 ../ex9 -ksp_converged_reason -ksp_error_if_not_converged -pc_fieldsplit_diag_use_amat 0 -pc_fieldsplit_diag_use_amat 0 -pc_fieldsplit_type additive > ex9_1.tmp 2> runex9_1.err 9794bcd95a3SBarry Smith... 9804bcd95a3SBarry Smith``` 9814bcd95a3SBarry Smith 9824bcd95a3SBarry SmithThis can still be hard to read and pick out what you want. So use the fact that you want `not ok` 9834bcd95a3SBarry Smithcombined with the fact that `#` is the delimiter: 9844bcd95a3SBarry Smith 9854bcd95a3SBarry Smith```console 9864bcd95a3SBarry Smith$ make test s='src/ksp/ksp/tests/ex9.c' i='*1' v=1 | grep 'not ok' | cut -d# -f2 9874bcd95a3SBarry Smithmpiexec -n 1 ../ex9 -ksp_converged_reason -ksp_error_if_not_converged -pc_fieldsplit_diag_use_amat 0 -pc_fieldsplit_diag_use_amat 0 -pc_fieldsplit_type multiplicative > ex9_1.tmp 2> runex9_1.err 9884bcd95a3SBarry Smith``` 9894bcd95a3SBarry Smith 990f605775fSPierre Jolivet## PETSc Test Harness 9914bcd95a3SBarry Smith 9924bcd95a3SBarry SmithThe goals of the PETSc test harness are threefold. 9934bcd95a3SBarry Smith 9944bcd95a3SBarry Smith1. Provide standard output used by other testing tools 9954bcd95a3SBarry Smith2. Be as lightweight as possible and easily fit within the PETSc build chain 9964bcd95a3SBarry Smith3. Provide information on all tests, even those that are not built or run because they do not meet the configuration requirements 9974bcd95a3SBarry Smith 9984bcd95a3SBarry SmithBefore understanding the test harness, you should first understand the 9994bcd95a3SBarry Smithdesired requirements for reporting and logging. 10004bcd95a3SBarry Smith 10014bcd95a3SBarry Smith### Testing the Parsing 10024bcd95a3SBarry Smith 10034bcd95a3SBarry SmithAfter inserting the language into the file, you can test the parsing by 10044bcd95a3SBarry Smithexecuting 10054bcd95a3SBarry Smith 10064bcd95a3SBarry SmithA dictionary will be pretty-printed. From this dictionary printout, any 10074bcd95a3SBarry Smithproblems in the parsing are is usually obvious. This python file is used 10084bcd95a3SBarry Smithby 10094bcd95a3SBarry Smith 10104bcd95a3SBarry Smithin generating the test harness. 10114bcd95a3SBarry Smith 10124bcd95a3SBarry Smith## Test Output Standards: TAP 10134bcd95a3SBarry Smith 10144bcd95a3SBarry SmithThe PETSc test system is designed to be compliant with the [Test Anything Protocol (TAP)](https://testanything.org/tap-specification.html). 10154bcd95a3SBarry Smith 10164bcd95a3SBarry SmithThis is a simple standard designed to allow testing tools to work 10174bcd95a3SBarry Smithtogether easily. There are libraries to enable the output to be used 10184bcd95a3SBarry Smitheasily, including sharness, which is used by the Git team. However, the 10194bcd95a3SBarry Smithsimplicity of the PETSc tests and TAP specification means that we use 10204bcd95a3SBarry Smithour own simple harness given by a single shell script that each file 10214bcd95a3SBarry Smithsources: `$PETSC_DIR/config/petsc_harness.sh`. 10224bcd95a3SBarry Smith 10234bcd95a3SBarry SmithAs an example, consider this test input: 10244bcd95a3SBarry Smith 10254bcd95a3SBarry Smith```yaml 10264bcd95a3SBarry Smithtest: 10274bcd95a3SBarry Smith suffix: 2 10284bcd95a3SBarry Smith output_file: output/ex138.out 10294bcd95a3SBarry Smith args: -f ${DATAFILESPATH}/matrices/small -mat_type {{aij baij sbaij}} -matload_block_size {{2 3}} 10304bcd95a3SBarry Smith requires: datafilespath 10314bcd95a3SBarry Smith``` 10324bcd95a3SBarry Smith 10334bcd95a3SBarry SmithA sample output from this would be: 10344bcd95a3SBarry Smith 10354bcd95a3SBarry Smith``` 10364bcd95a3SBarry Smithok 1 In mat...tests: "./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type aij -matload_block_size 2" 10374bcd95a3SBarry Smithok 2 In mat...tests: "Diff of ./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type aij -matload_block_size 2" 10384bcd95a3SBarry Smithok 3 In mat...tests: "./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type aij -matload_block_size 3" 10394bcd95a3SBarry Smithok 4 In mat...tests: "Diff of ./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type aij -matload_block_size 3" 10404bcd95a3SBarry Smithok 5 In mat...tests: "./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type baij -matload_block_size 2" 10414bcd95a3SBarry Smithok 6 In mat...tests: "Diff of ./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type baij -matload_block_size 2" 10424bcd95a3SBarry Smith... 10434bcd95a3SBarry Smith 10444bcd95a3SBarry Smithok 11 In mat...tests: "./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type saij -matload_block_size 2" 10454bcd95a3SBarry Smithok 12 In mat...tests: "Diff of ./ex138 -f ${DATAFILESPATH}/matrices/small -mat_type aij -matload_block_size 2" 10464bcd95a3SBarry Smith``` 10474bcd95a3SBarry Smith 10484bcd95a3SBarry Smith## Test Harness Implementation 10494bcd95a3SBarry Smith 10504bcd95a3SBarry SmithMost of the requirements for being TAP-compliant lie in the shell 10514bcd95a3SBarry Smithscripts, so we focus on that description. 10524bcd95a3SBarry Smith 10534bcd95a3SBarry SmithA sample shell script is given the following. 10544bcd95a3SBarry Smith 10554bcd95a3SBarry Smith```sh 10564bcd95a3SBarry Smith#!/bin/sh 10574bcd95a3SBarry Smith. petsc_harness.sh 10584bcd95a3SBarry Smith 10594bcd95a3SBarry Smithpetsc_testrun ./ex1 ex1.tmp ex1.err 10604bcd95a3SBarry Smithpetsc_testrun 'diff ex1.tmp output/ex1.out' diff-ex1.tmp diff-ex1.err 10614bcd95a3SBarry Smith 10624bcd95a3SBarry Smithpetsc_testend 10634bcd95a3SBarry Smith``` 10644bcd95a3SBarry Smith 10654bcd95a3SBarry Smith`petsc_harness.sh` is a small shell script that provides the logging and reporting 10664bcd95a3SBarry Smithfunctions `petsc_testrun` and `petsc_testend`. 10674bcd95a3SBarry Smith 10684bcd95a3SBarry SmithA small sample of the output from the test harness is as follows. 10694bcd95a3SBarry Smith 10704bcd95a3SBarry Smith```none 10714bcd95a3SBarry Smithok 1 ./ex1 10724bcd95a3SBarry Smithok 2 diff ex1.tmp output/ex1.out 10734bcd95a3SBarry Smithnot ok 4 ./ex2 10744bcd95a3SBarry Smith# ex2: Error: cannot read file 10754bcd95a3SBarry Smithnot ok 5 diff ex2.tmp output/ex2.out 10764bcd95a3SBarry Smithok 7 ./ex3 -f /matrices/small -mat_type aij -matload_block_size 2 10774bcd95a3SBarry Smithok 8 diff ex3.tmp output/ex3.out 10784bcd95a3SBarry Smithok 9 ./ex3 -f /matrices/small -mat_type aij -matload_block_size 3 10794bcd95a3SBarry Smithok 10 diff ex3.tmp output/ex3.out 10804bcd95a3SBarry Smithok 11 ./ex3 -f /matrices/small -mat_type baij -matload_block_size 2 10814bcd95a3SBarry Smithok 12 diff ex3.tmp output/ex3.out 10824bcd95a3SBarry Smithok 13 ./ex3 -f /matrices/small -mat_type baij -matload_block_size 3 10834bcd95a3SBarry Smithok 14 diff ex3.tmp output/ex3.out 10844bcd95a3SBarry Smithok 15 ./ex3 -f /matrices/small -mat_type sbaij -matload_block_size 2 10854bcd95a3SBarry Smithok 16 diff ex3.tmp output/ex3.out 10864bcd95a3SBarry Smithok 17 ./ex3 -f /matrices/small -mat_type sbaij -matload_block_size 3 10874bcd95a3SBarry Smithok 18 diff ex3.tmp output/ex3.out 10884bcd95a3SBarry Smith# FAILED 4 5 10894bcd95a3SBarry Smith# failed 2/16 tests; 87.500% ok 10904bcd95a3SBarry Smith``` 10914bcd95a3SBarry Smith 10924bcd95a3SBarry SmithFor developers, modifying the lines that get written to the file can be 10934bcd95a3SBarry Smithdone by modifying `$PETSC_DIR/config/example_template.py`. 10944bcd95a3SBarry Smith 10954bcd95a3SBarry SmithTo modify the test harness, you can modify `$PETSC_DIR/config/petsc_harness.sh`. 10964bcd95a3SBarry Smith 10974bcd95a3SBarry Smith### Additional Tips 10984bcd95a3SBarry Smith 10994bcd95a3SBarry SmithTo rerun just the reporting use 11004bcd95a3SBarry Smith 11014bcd95a3SBarry Smith```console 11024bcd95a3SBarry Smith$ config/report_tests.py 11034bcd95a3SBarry Smith``` 11044bcd95a3SBarry Smith 11054bcd95a3SBarry SmithTo see the full options use 11064bcd95a3SBarry Smith 11074bcd95a3SBarry Smith```console 11084bcd95a3SBarry Smith$ config/report_tests.py -h 11094bcd95a3SBarry Smith``` 11104bcd95a3SBarry Smith 11114bcd95a3SBarry SmithTo see the full timing information for the five most expensive tests use 11124bcd95a3SBarry Smith 11134bcd95a3SBarry Smith```console 11144bcd95a3SBarry Smith$ config/report_tests.py -t 5 11154bcd95a3SBarry Smith``` 1116