Skip to content

Commit e844290

Browse files
authored
Add a qemu_coverage test in ci (#2883)
* add a qemu_coverage test in ci * update CI path for changes in qemu-related code
1 parent 2cc2298 commit e844290

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ jobs:
344344
- 'libafl_bolts/**'
345345
- 'libafl_targets/**'
346346
- 'libafl_qemu/**'
347-
- 'fuzzers/*qemu*/**'
347+
- 'fuzzers/**/*qemu*/**'
348348
349349
fuzzers-qemu:
350350
needs:

fuzzers/binary_only/qemu_coverage/Makefile.toml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,38 @@ rm -rf ${CARGO_MAKE_CRATE_TARGET_DIRECTORY}
288288
cargo clean
289289
'''
290290

291+
[tasks.test_inner]
292+
script_runner = "@shell"
293+
script = '''
294+
cargo make ${FEATURE} || exit 1
295+
296+
cargo run --manifest-path ../../../utils/drcov_utils/Cargo.toml --bin drcov_merge -- \
297+
-i ${TARGET_DIR}/drcov-000.log ${TARGET_DIR}/drcov-001.log ${TARGET_DIR}/drcov-002.log ${TARGET_DIR}/drcov-003.log \
298+
--output ${TARGET_DIR}/drcov-merged.log || exit 1
299+
300+
TMP=$(cargo run --manifest-path ../../../utils/drcov_utils/Cargo.toml --bin drcov_dump_addrs -- \
301+
-i ${TARGET_DIR}/drcov-merged.log | wc -l || exit 1)
302+
303+
NB_BLOCKS=$((TMP - 1))
304+
305+
echo "Nb blocks found: $NB_BLOCKS"
306+
307+
if [ $NB_BLOCKS -ge 1700 ]; then
308+
echo "Test succeeded"
309+
else
310+
echo "Did not find more than 1700 blocks."
311+
exit 1
312+
fi
313+
'''
314+
291315
[tasks.arm]
292316
command = "cargo"
293317
args = ["make", "-p", "arm", "run"]
294318

319+
[tasks.test_arm]
320+
command = "cargo"
321+
args = ["make", "-p", "arm", "test_inner"]
322+
295323
[tasks.aarch64]
296324
command = "cargo"
297325
args = ["make", "-p", "aarch64", "run"]
@@ -300,6 +328,10 @@ args = ["make", "-p", "aarch64", "run"]
300328
command = "cargo"
301329
args = ["make", "-p", "x86_64", "run"]
302330

331+
[tasks.test_x86_64]
332+
command = "cargo"
333+
args = ["make", "-p", "x86_64", "test_inner"]
334+
303335
[tasks.i386]
304336
command = "cargo"
305337
args = ["make", "-p", "i386", "run"]
@@ -316,4 +348,4 @@ args = ["make", "-p", "ppc", "run"]
316348
dependencies = ["arm", "aarch64", "x86_64", "i386", "mips", "ppc"]
317349

318350
[tasks.lightweight]
319-
dependencies = ["arm", "x86_64"]
351+
dependencies = ["test_x86_64", "test_arm"]

0 commit comments

Comments
 (0)