From d3942b242c2ca5c76343640651b67f0db433fccf Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Mon, 10 May 2021 17:44:50 +0000 Subject: [PATCH 1/2] LUCI: Add build fuzz tests script to presubmits Merge from Widevine repo of http://go/wvgerrit/123803 Update fuzz build script to use gyp from third_party folder. Test: ran fuzz tests on luci bug: 186271314 bug: 184866351 Change-Id: If530872aa1e60d2108932610415aa5315979390c --- .../oemcrypto/test/fuzz_tests/build_oemcrypto_fuzztests | 9 ++++++--- .../test/fuzz_tests/oemcrypto_load_license_fuzz.cc | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libwvdrmengine/oemcrypto/test/fuzz_tests/build_oemcrypto_fuzztests b/libwvdrmengine/oemcrypto/test/fuzz_tests/build_oemcrypto_fuzztests index bbffd4eb..f30cacd0 100755 --- a/libwvdrmengine/oemcrypto/test/fuzz_tests/build_oemcrypto_fuzztests +++ b/libwvdrmengine/oemcrypto/test/fuzz_tests/build_oemcrypto_fuzztests @@ -4,13 +4,16 @@ set -ex export CXX=clang++ export CC=clang export GYP_DEFINES="$GYP_DEFINES clang=1" - export PATH_TO_CDM_DIR=. -gyp --format=ninja --depth=$(pwd) oemcrypto/test/fuzz_tests/oemcrypto_fuzztests.gyp +export PYTHONPATH="$PYTHONPATH:$PATH_TO_CDM_DIR/third_party" + +python3 $PATH_TO_CDM_DIR/third_party/gyp/__init__.py --format=ninja \ + --depth=$(pwd) oemcrypto/test/fuzz_tests/oemcrypto_fuzztests.gyp ninja -C out/Default # oemcrypto_odkitee_fuzztests.gypi has flags to instrument all the gyp targets # with fuzzer flags. -gyp --format=ninja --depth=$(pwd) \ +python3 $PATH_TO_CDM_DIR/third_party/gyp/__init__.py --format=ninja \ + --depth=$(pwd) \ --include=oemcrypto/test/fuzz_tests/oemcrypto_odkitee_fuzztests.gypi \ oemcrypto/test/fuzz_tests/oemcrypto_odkitee_fuzztests.gyp ninja -C out/Default \ No newline at end of file diff --git a/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_load_license_fuzz.cc b/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_load_license_fuzz.cc index 73ba25cd..64f5f4b5 100644 --- a/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_load_license_fuzz.cc +++ b/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_load_license_fuzz.cc @@ -20,7 +20,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // Convert OEMCrypto_LicenseType in core_response to a valid enum value. ConvertDataToValidEnum( - OEMCrypto_LicenstType_MaxValue, + OEMCrypto_LicenseType_MaxValue, &license_api_fuzz.license_messages().core_response().license_type); license_api_fuzz.license_messages().EncryptAndSignResponse(); From 20833734e1cebff4f2a5bb3a23e5909f4e68f3e2 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Thu, 20 May 2021 15:28:12 +0000 Subject: [PATCH 2/2] Add fudge to duration tests Merge from Widevine repo of http://go/wvgerrit/125046 Add some extra fudge to the termination time. This assumes that flaky tests were caused by roundoff error. Bug: 175741647 Change-Id: I9bcc86f9b9540e5985df647dd1b5c5d439556e2b --- libwvdrmengine/cdm/core/test/duration_use_case_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp index c778eace..68d87241 100644 --- a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp +++ b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp @@ -358,8 +358,10 @@ class CdmDurationTest : public WvCdmTestBaseWithEngine, // this tests a cyan bar with a black X. This assumes that |cutoff| is before // |stop|. Both |start| and |cutoff| are system times. void TerminatePlayback(uint64_t start, uint64_t cutoff) { - ASSERT_LT(start, cutoff); - AllowPlayback(start, cutoff); + // We subtract some fudge from the cutoff to account for possible round off + // error when computing the playback window. + ASSERT_LT(start, cutoff - kFudge); + AllowPlayback(start, cutoff - kFudge); SleepUntil(cutoff + kFudge); FailDecrypt(); }