diff options
author | Aaron Knobloch <aknobloch@google.com> | 2024-05-29 20:46:34 -0700 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-07-09 15:10:19 +0000 |
commit | 8934b1ef0857bc08626a2206a6f5f718942c14fc (patch) | |
tree | 0b16f1aed41ef07bf3e5c18f645246408ee64605 /util | |
parent | 7c2b62e93487b772990fddc1905f22d4cfaee4a4 (diff) | |
download | boringssl-master.zip boringssl-master.tar.gz boringssl-master.tar.bz2 |
The QEMU option is particularly useful for running RISC-V based tests,
for which there does not exist any RISC-V hardware for native execution.
This change was verified locally using the following command:
go run util/all_tests.go \
--qemu /usr/local/google/home/aknobloch/Downloads/qemu-build/usr/bin/qemu-riscv64 \
The tests took ~20 minutes to complete.
Change-Id: Ide9514d5d6a024d8c42a4a129d7e4a6582b5878a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68887
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: Aaron Knobloch <aknobloch@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/all_tests.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/util/all_tests.go b/util/all_tests.go index 4090943..d80cd60 100644 --- a/util/all_tests.go +++ b/util/all_tests.go @@ -48,6 +48,7 @@ var ( mallocTest = flag.Int64("malloc-test", -1, "If non-negative, run each test with each malloc in turn failing from the given number onwards.") mallocTestDebug = flag.Bool("malloc-test-debug", false, "If true, ask each test to abort rather than fail a malloc. This can be used with a specific value for --malloc-test to identity the malloc failing that is causing problems.") simulateARMCPUs = flag.Bool("simulate-arm-cpus", simulateARMCPUsDefault(), "If true, runs tests simulating different ARM CPUs.") + qemuBinary = flag.String("qemu", "", "Optional, absolute path to a binary location for QEMU runtime.") ) func simulateARMCPUsDefault() bool { @@ -145,6 +146,13 @@ func sdeOf(cpu, path string, args ...string) *exec.Cmd { return exec.Command(*sdePath, sdeArgs...) } +func qemuOf(path string, args ...string) *exec.Cmd { + // The QEMU binary becomes the program to run, and the previous test program + // to run instead becomes an additional argument to the QEMU binary. + args = append([]string{path}, args...) + return exec.Command(*qemuBinary, args...) +} + var ( errMoreMallocs = errors.New("child process did not exhaust all allocation calls") errTestSkipped = errors.New("test was skipped") @@ -161,6 +169,7 @@ func runTestOnce(test test, mallocNumToFail int64) (passed bool, err error) { // detected. args = append(args, "--no_unwind_tests") } + var cmd *exec.Cmd if *useValgrind { cmd = valgrindOf(false, prog, args...) @@ -170,6 +179,8 @@ func runTestOnce(test test, mallocNumToFail int64) (passed bool, err error) { cmd = gdbOf(prog, args...) } else if *useSDE { cmd = sdeOf(test.cpu, prog, args...) + } else if *qemuBinary != "" { + cmd = qemuOf(prog, args...) } else { cmd = exec.Command(prog, args...) } |