Skip to content

Commit f9f831c

Browse files
committed
aws-crt-cpp, aws-lc, aws-sdk-cpp, s2n: enable sanitizer tests for all archs
1 parent 0f25deb commit f9f831c

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

recipes-sdk/aws-crt-cpp/aws-crt-cpp/run-ptest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ do
6868
./aws-crt-cpp-tests $TEST >> tests.log 2>&1
6969
done
7070

71-
sed -e '/\[\s/!d ; /OK/ s/^/PASS: / ; /FAILED/ s/^/FAIL: /' tests.log
71+
sed -e '/\[\s\|==.*==\|runtime error:/!d ; /OK/ s/^/PASS: / ; /FAILED\|ERROR: .*Sanitizer\|runtime error:/ s/^/FAIL: /' tests.log

recipes-sdk/aws-crt-cpp/aws-crt-cpp_0.29.9.bb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ OECMAKE_GENERATOR = "Unix Makefiles"
4545

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

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

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

7576
# -fsanitize=address does cause this
7677
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
77-
INSANE_SKIP:x86-64 += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
78-
PACKAGECONFIG[sanitize] = "-DENABLE_SANITIZERS=ON -DSANITIZERS=address, -DENABLE_SANITIZERS=OFF,gcc-sanitizers"
78+
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
79+
80+
PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
81+
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address -fno-omit-frame-pointer', '', d)}"

recipes-sdk/aws-lc/aws-lc_1.42.0.bb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ PACKAGECONFIG ??= "\
2929
PACKAGECONFIG[with-tests] = "-DBUILD_TESTING=ON -DCMAKE_CROSSCOMPILING=OFF,-DBUILD_TESTING=OFF,"
3030

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

3437
do_install_ptest () {

recipes-sdk/aws-sdk-cpp/aws-sdk-cpp_1.11.488.bb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ inherit cmake ptest pkgconfig
2828
PACKAGECONFIG ?= "\
2929
${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)} \
3030
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
31+
${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)} \
3132
"
3233

33-
PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"
34-
3534
PACKAGECONFIG[pulseaudio] = "-DPULSEAUDIO=TRUE, -DPULSEAUDIO=FALSE, pulseaudio"
3635

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

73+
EXTRA_OECMAKE += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}"
74+
7475
RDEPENDS:${PN}-ptest += "\
7576
bash \
7677
python3 \
@@ -91,8 +92,5 @@ do_install_ptest () {
9192
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
9293
INSANE_SKIP:${PN}-src:append:class-target:arm = " buildpaths"
9394

94-
# -fsanitize=address does cause this
95-
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
96-
INSANE_SKIP:x86-64 += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
97-
98-
PACKAGECONFIG[sanitize] = "'-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer',,gcc-sanitizers"
95+
PACKAGECONFIG[sanitize] = ",,gcc-sanitizers"
96+
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address -fno-omit-frame-pointer', '', d)}"

recipes-sdk/s2n/s2n_1.5.11.bb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ CFLAGS:append = " -Wl,-Bsymbolic"
2828

2929
PACKAGECONFIG ?= "\
3030
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
31-
"
32-
33-
PACKAGECONFIG:append:x86-64 = "\
3431
${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)} \
3532
"
3633

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

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

42-
EXTRA_OECMAKE += "\
43-
-DCMAKE_BUILD_TYPE=Release \
44-
"
39+
PACKAGECONFIG[sanitize] = "-DS2N_ADDRESS_SANITIZER=ON, -DS2N_ADDRESS_SANITIZER=OFF, gcc-sanitizers"
40+
41+
EXTRA_OECMAKE += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}"
42+
4543
# Fix "doesn't have GNU_HASH (didn't pass LDFLAGS?)" issue
4644
TARGET_CC_ARCH += "${LDFLAGS}"
4745

@@ -63,4 +61,4 @@ do_install_ptest () {
6361

6462
BBCLASSEXTEND = "native nativesdk"
6563

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

0 commit comments

Comments
 (0)