Skip to content

Commit

Permalink
aws-crt-cpp, aws-lc, aws-sdk-cpp, s2n: enable sanitizer tests for all…
Browse files Browse the repository at this point in the history
… archs
  • Loading branch information
thomas-roos committed Jan 21, 2025
1 parent 0f25deb commit cb46854
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion recipes-sdk/aws-crt-cpp/aws-crt-cpp/run-ptest
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ do
./aws-crt-cpp-tests $TEST >> tests.log 2>&1
done

sed -e '/\[\s/!d ; /OK/ s/^/PASS: / ; /FAILED/ s/^/FAIL: /' tests.log
sed -e '/\[\s\|==.*==\|runtime error:/!d ; /OK/ s/^/PASS: / ; /FAILED\|ERROR: .*Sanitizer\|runtime error:/ s/^/FAIL: /' tests.log
9 changes: 6 additions & 3 deletions recipes-sdk/aws-crt-cpp/aws-crt-cpp_0.29.9.bb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ OECMAKE_GENERATOR = "Unix Makefiles"

PACKAGECONFIG ?= "\
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)} \
"

PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"
EXTRA_OECMAKE += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}"

# enable PACKAGECONFIG = "static" to build static instead of shared libs
PACKAGECONFIG[static] = "-DBUILD_SHARED_LIBS=OFF,-DBUILD_SHARED_LIBS=ON"
Expand All @@ -74,5 +75,7 @@ do_install_ptest () {

# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP:x86-64 += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
PACKAGECONFIG[sanitize] = "-DENABLE_SANITIZERS=ON -DSANITIZERS=address, -DENABLE_SANITIZERS=OFF,gcc-sanitizers"
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address -fno-omit-frame-pointer', '', d)}"
3 changes: 3 additions & 0 deletions recipes-sdk/aws-lc/aws-lc_1.42.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ PACKAGECONFIG ??= "\
PACKAGECONFIG[with-tests] = "-DBUILD_TESTING=ON -DCMAKE_CROSSCOMPILING=OFF,-DBUILD_TESTING=OFF,"

# enable PACKAGECONFIG = "static" to build static instead of shared libs
# this will conflict with PTESTS, do disable them in your local.conf
# by setting
# PTEST_ENABLED:pn-aws-lc = "0"
PACKAGECONFIG[static] = "-DBUILD_SHARED_LIBS=OFF,-DBUILD_SHARED_LIBS=ON"

do_install_ptest () {
Expand Down
11 changes: 6 additions & 5 deletions recipes-sdk/aws-sdk-cpp/aws-sdk-cpp_1.11.488.bb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ inherit cmake ptest pkgconfig
PACKAGECONFIG ?= "\
${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)} \
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)} \
"

PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"

PACKAGECONFIG[pulseaudio] = "-DPULSEAUDIO=TRUE, -DPULSEAUDIO=FALSE, pulseaudio"

# CMAKE_CROSSCOMPILING=OFF will enable build of unit tests
Expand Down Expand Up @@ -71,6 +70,8 @@ EXTRA_OECMAKE += "\
-DCMAKE_MODULE_PATH=${STAGING_LIBDIR}/cmake \
"

EXTRA_OECMAKE += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}"

RDEPENDS:${PN}-ptest += "\
bash \
python3 \
Expand All @@ -93,6 +94,6 @@ INSANE_SKIP:${PN}-src:append:class-target:arm = " buildpaths"

# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP:x86-64 += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

PACKAGECONFIG[sanitize] = "'-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer',,gcc-sanitizers"
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
PACKAGECONFIG[sanitize] = ",,gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address -fno-omit-frame-pointer', '', d)}"
12 changes: 5 additions & 7 deletions recipes-sdk/s2n/s2n_1.5.11.bb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ CFLAGS:append = " -Wl,-Bsymbolic"

PACKAGECONFIG ?= "\
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
"

PACKAGECONFIG:append:x86-64 = "\
${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)} \
"

Expand All @@ -39,9 +36,10 @@ PACKAGECONFIG[static] = "-DBUILD_SHARED_LIBS=OFF,-DBUILD_SHARED_LIBS=ON"

PACKAGECONFIG[with-tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,"

EXTRA_OECMAKE += "\
-DCMAKE_BUILD_TYPE=Release \
"
PACKAGECONFIG[sanitize] = "-DS2N_ADDRESS_SANITIZER=ON, -DS2N_ADDRESS_SANITIZER=OFF, gcc-sanitizers"

EXTRA_OECMAKE += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}"

# Fix "doesn't have GNU_HASH (didn't pass LDFLAGS?)" issue
TARGET_CC_ARCH += "${LDFLAGS}"

Expand All @@ -63,4 +61,4 @@ do_install_ptest () {

BBCLASSEXTEND = "native nativesdk"

PACKAGECONFIG[sanitize] = "-DS2N_ADDRESS_SANITIZER=ON, -DS2N_ADDRESS_SANITIZER=OFF, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address', '', d)}"

0 comments on commit cb46854

Please sign in to comment.