summaryrefslogtreecommitdiff
path: root/test/build.mk
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-20 14:21:43 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-16 00:30:08 -0700
commit4a4e2c71a0f6aaa50e0728922f84a7d54c14380a (patch)
tree4bbc05387f7b479bc4a3dcb925174676f03d9356 /test/build.mk
parent165ee29673b058ba5f4550d5b6e1dfecb179bb22 (diff)
downloadchrome-ec-4a4e2c71a0f6aaa50e0728922f84a7d54c14380a.tar.gz
test: host_command_fuzz: fuzzing test
Writing fuzzing tests is a little tricky, as clang takes over the main function. Instead, we start the test main function in a thread, and have LLVMFuzzerTestOneInput prepare the host command buffer, and wake the TEST_RUNNER task. To make fuzzing faster, we only send somehow correctly formed requests, with a valid checksum and length (this can be disabled with an option). We also make sure that the emulator does not hibernate, reboot or jump to a different image when fuzzing is enabled. BRANCH=none BUG=chromium:854975 TEST=make buildfuzztests -j ASAN_OPTIONS="log_path=stderr" \ build/host/host_command_fuzz/host_command_fuzz.exe -timeout=5 Change-Id: I27b25e44c405f118dfc1296247479245e15e54b4 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107523 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jonathan Metzman <metzman@chromium.org>
Diffstat (limited to 'test/build.mk')
-rw-r--r--test/build.mk4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/build.mk b/test/build.mk
index d1ca94b7dc..967231684e 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -65,6 +65,9 @@ test-list-host += vboot
test-list-host += x25519
endif
+# Fuzzing tests
+fuzz-test-list-host = host_command_fuzz
+
base32-y=base32.o
battery_get_params_smart-y=battery_get_params_smart.o
bklight_lid-y=bklight_lid.o
@@ -81,6 +84,7 @@ fan-y=fan.o
flash-y=flash.o
hooks-y=hooks.o
host_command-y=host_command.o
+host_command_fuzz-y=host_command_fuzz.o
inductive_charging-y=inductive_charging.o
interrupt-scale=10
interrupt-y=interrupt.o