This is an archive of the discontinued LLVM Phabricator instance.

[LNT][test-suite] Implement a new option: --single-result
ClosedPublic

Authored by jmolloy on Feb 29 2016, 6:07 AM.

Details

Summary

The idea behind this option is to ease bisecting using tools like 'llvmlab bisect'. With --only-test we can already narrow down the tests we want to run to one test, however we still produce a report.json and exit success no matter if the test passed or failed.

With --single-result, we only perform one test (it sets --only-test) but the exit status of LNT is determined by a predicate which allows it to be used directly with llvmlab exec / llvmlab bisect.

The predicate is set with --single-result-predicate, and is a python expression. It is evaluated in a context that contains 'status', a boolean representing the pass or fail status of the test, and all of the metrics exposed by LIT. Where metrics have different names in LIT and LNT parlance (for example 'exec' in LNT and 'exec_time' in LIT) both names are exposed. This has a sideeffect of working around a feature of Python - 'exec' is a keyword so cannot be used as a variable!

The default predicate is simply "status". This causes the exit status of LNT to correspond to the pass/fail status of the test - useful for conformance testing. Predicates such as "status and exec_time > 6.0" allow for simple performance bisections.

We've been using this feature internally for a week or so now and have found our bisections have become a lot easier. An example bisect command would be:

$ llvmlab bisect -b ARM-aarch32 --min-rev=261265 --max-rev=261369 \
    lnt runtest test-suite \
    --cc '%(path)s/bin/clang' \
    --sandbox SANDBOX \
    --test-suite /work/llvm-test-suite \
    --use-lit lit \
    --run-under 'taskset -c 5' \
    --cflags '-O3 -mthumb -mcpu=cortex-a57' \
    --single-result MultiSource/Benchmarks/TSVC/Expansion-flt/Expansion-flt.test \
    --single-result-predicate 'exec_time > 8.0'

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 49366.Feb 29 2016, 6:07 AM
jmolloy retitled this revision from to [LNT][test-suite] Implement a new option: --single-result.
jmolloy updated this object.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: llvm-commits.
kristof.beyls added inline comments.Feb 29 2016, 11:41 PM
lnt/tests/test_suite.py
154–158

The help text doesn't indicate that this argument expects a fully-qualified test name.
Also, it seems like this argument changes test execution - so is it best placed in the "Test Execution" group, or here in the "Output Options" group?

All in all, the help text is a bit long. Maybe it would be better to shorten the help text here and write some more elaborate documentation with an example for this in one of the rst files under docs, so that how to use this becomes part of the LNT documentation?
Should the documentation for the bisecter (which I guess lives in zorg) be updated to have an example making use of these options?

230–232

Don't we have directories with multiple tests in the same directory? e.g. test-suite/SingleSource/Regression/C
Does this mean that at most a full directory can be specified, not a single test?
Would using this to bisect a single test in a directory with multiple tests still work?

MatzeB accepted this revision.Apr 12 2016, 11:41 AM
MatzeB edited edge metadata.

I believe this was committed in r263445, accepting & closing.

This revision is now accepted and ready to land.Apr 12 2016, 11:41 AM
MatzeB closed this revision.Apr 12 2016, 11:41 AM

I believe this was committed in r263445, accepting & closing.