-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disasm-test: Overhaul treatment of LLVM version ranges
This is a minor rewrite of the logic used to check for LLVM version ranges in `disasm-llvm` test cases. The new approach is similar to Case 3/3a from this `tasty-sugar` document: https://github.com/kquick/tasty-sugar/blob/1fc06bee124e02f49f6478bc1e1df13704cc4916/Ranges.org#case-3---explicit-and-a-weak atch In particular: * We have adopted the convention that the test output for the most recent version of LLVM is always contained in a bare `.ll` file. * There are no longer any `at-least-llvm*` files, just `pre-llvm*`. This greatly simplifies the number of cases to consider and the number of checks to implement. * We now skip test configurations by having `SKIP_TEST` as the first line of the `.ll` file. Again, this greatly simplifies the logic needed to skip test cases on certain configurations. This is heavily inspired by a similar change made in GaloisInc/crucible#1083.
- Loading branch information
1 parent
37e1870
commit e76b9c6
Showing
19 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# `disasm-test` | ||
|
||
This test suite ensures that for each `.ll` file under the `tests` directory: | ||
|
||
1. After using `llvm-as` to produce a `.bc` file, the `.bc` file can be parsed | ||
using `llvm-pretty-bc-parser`. | ||
2. The resulting `llvm-pretty` AST can be pretty-printed back out to an `.ll` | ||
file using `llvm-pretty`'s pretty-printer. | ||
3. The new `.ll` file is mostly equivalent to the original `.ll` file. | ||
|
||
Here, "mostly equivalent" means that the two files are syntactically | ||
equivalent, ignoring minor differences in whitespace and the order of metadata | ||
in the metadata list. | ||
|
||
## Conditional tests | ||
|
||
Some of the test cases have slightly different bitcode depending on which LLVM | ||
version is used. These test cases will have accompanying | ||
`<test-case>.pre-llvm<version>.ll` files, where `pre-llvm<version>` indicates | ||
that this test output is used for all LLVM versions up to (but not including) | ||
`<version>`. Note that if a test case has multiple `pre-llvm<version>.ll` | ||
files, then the `<version>` that is closest to the current LLVM version | ||
(without going over) is picked. | ||
|
||
To illustrate this with a concrete example, consider suppose we have a test | ||
case `foo` with the following `.ll` files | ||
|
||
* `foo.pre-llvm11.ll` | ||
* `foo.pre-llvm13.ll` | ||
* `foo.ll` | ||
|
||
The following `.ll` files would be used for the following LLVM versions: | ||
|
||
* LLVM 10: `foo.pre-llvm11.ll` | ||
* LLVM 11: `foo.pre-llvm13.ll` | ||
* LLVM 12: `foo.pre-llvm13.ll` | ||
* LLVM 13 or later: `foo.ll` | ||
|
||
There are some test cases that require a sufficiently recent LLVM version to | ||
run. To indicate that a test should not be run on LLVMs older than `<version>`, | ||
create a `pre-llvm<version>.ll` file with `SKIP_TEST` as the first line. The | ||
use of `SKIP_TEST` signals that this test should be skipped when using LLVMs | ||
older than `<version>`. Note that the test suite will not read anything past | ||
`SKIP_TEST`, so the rest of the file can be used to document why the test is | ||
skipped on that particular configuration. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_TEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters