OSDN Git Service

Allow conditional lit tests in Subzero, based on build flags.
authorKarl Schimpf <kschimpf@google.com>
Mon, 27 Oct 2014 21:41:57 +0000 (14:41 -0700)
committerKarl Schimpf <kschimpf@google.com>
Mon, 27 Oct 2014 21:41:57 +0000 (14:41 -0700)
commitb262c5e0b110e63ec706213adf0af202274c442e
treeb49eb08a5ac681703b28efbd600751c670303d1c
parent120b4121c313ee7faf8095c3b52998f447e2061e
Allow conditional lit tests in Subzero, based on build flags.

Adds conditionality to lit tests in two ways:

1) Allows the use of "; REQUIRES: XXX" lines in lit tests. In this
case, the tests defined by the file are only run if all REQUIRES are
met.

2) Allows the conditional running of RUN commands, based on build
flags. This comes in two subforms. There are predefined %ifX commands
that run the command defined by remaining arguments, if the
corresponding %X2i command is applicable. Alternatively, one can use
%if with explicit '--att' arguments to define what conditions should
be checked.

In any case, unlike REQUIRES, the %if commands RUN all the time, but
simply generate empty output, rather then output defined by the
following command, if the condition is not met. These latter tests are
useful when the same input is to be tested under different conditions,
since the REQUIRES form does not allow this.

Note that m2i, p2i, l2i, and lc2i are also conditionally controlled,
so that they do nothing if the build did not construct the appropriate
Subzero translator.

This CL replaces https://codereview.chromium.org/644143002

BUG=None
R=jvoung@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/659513005
21 files changed:
Makefile
Makefile.standalone
pydir/ifatts.py [new file with mode: 0755]
src/IceTypes.cpp
src/IceTypes.def
src/IceTypes.h
src/llvm2ice.cpp
tests_lit/lit.cfg
tests_lit/llvm2ice_tests/addr-opt-multi-def-var.ll
tests_lit/llvm2ice_tests/align-spill-locations.ll
tests_lit/llvm2ice_tests/ebp_args.ll
tests_lit/llvm2ice_tests/global.ll
tests_lit/llvm2ice_tests/globalrelocs.ll
tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll
tests_lit/llvm2ice_tests/phi.ll
tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
tests_lit/reader_tests/binops.ll
tests_lit/reader_tests/extern_globals.ll
tests_lit/reader_tests/globalinit.pnacl.ll
tests_lit/reader_tests/globalrelocs.ll
tests_lit/reader_tests/unnamed.ll