Fix failing test in armv4/armv5 -O3

This commit is contained in:
Joao Paulo Magalhaes
2025-10-21 17:46:37 +01:00
parent ca353d26fa
commit 6e7b1c5da7
2 changed files with 53 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
!yamlscript/v0:
# DOCKER DEBUGGING EXAMPLES AT THE END!
:use common: :all
:: workflow-setup()
@@ -113,3 +116,41 @@ jobs:
needs: [canary11, canary20]
:: setup-job('embedded' 'xcompile')
:: define-job(rest(matrix-items) steps20 'c++20')
# command examples to test in docker
#
#
# apt-get install g{cc,++}-arm-linux-gnueabi
# docker exec -it 7e711fd09471 bash -c '( set -xe ; \
# arch=armv4 ; flags=" -march=armv4" ; bt=Release ; std=11 ; \
# bd=build/docker/$arch-$bt ; \
# export C4_EXTERN_DIR=`pwd`/build/extern ; \
# function cm() { \
# cmake -B $bd -D CMAKE_TOOLCHAIN_FILE=ext/c4core/.github/toolchains/$arch.cmake \
# -DCMAKE_BUILD_TYPE=$bt -DC4_CXX_STANDARD=$std -D CXX_STANDARD=$std \
# -DCMAKE_CXX_FLAGS=" $flags" -DCMAKE_C_FLAGS=" $flags" \
# -DRYML_BUILD_TESTS=ON -D RYML_VALGRIND=OFF ; \
# cmake --build $bd -j --target "$@" ; \
# } ; \
# tgt=ryml-test-parser ; \
# exe=./$bd/test/$tgt ; \
# cm $tgt ; \
# qemu-arm-static -L /usr/arm-linux-gnueabi $exe --gtest_filter="*in_arena_noparser_4*" \
# )'
#
#
#
# ( set -xe ; \
# arch=aaarch64 ; flags="" ; bt=Release ; std=11 ; \
# bd=build/docker/$arch-$bt ; \
# export C4_EXTERN_DIR=`pwd`/build/extern ; \
# function cm() { \
# cmake -B $bd -D CMAKE_TOOLCHAIN_FILE=ext/c4core/.github/toolchains/$arch.cmake \
# -DCMAKE_BUILD_TYPE=$bt -DC4_CXX_STANDARD=$std -D CXX_STANDARD=$std \
# -DCMAKE_CXX_FLAGS="$flags" -DCMAKE_C_FLAGS="$flags" \
# -DRYML_BUILD_TESTS=ON -D RYML_VALGRIND=OFF ; \
# cmake --build $bd -j --target "$@" ; \
# } ; \
# cm ryml-test-run )

View File

@@ -856,10 +856,19 @@ TEST_F(ParseOverloadYamlTest, in_arena_noparser_3_2)
test_compare(actual, ref);
check_tree(actual, actual.arena());
}
// workaround for optimizer problem in armv4 and armv5 with -O3: when
// the calling the parser overloads that take a NodeRef, the compiler
// optimizes the tree away
static C4_NO_INLINE void ensure_compiler_knows_tree_was_changed(Tree *t)
{
C4_DONT_OPTIMIZE(*t);
print_tree(*t); // this was also needed (?)
}
TEST_F(ParseOverloadYamlTest, in_arena_noparser_4_1)
{
Tree actual;
parse_in_arena(cyaml, actual.rootref());
ensure_compiler_knows_tree_was_changed(&actual);
test_compare(actual, ref);
check_tree(actual, actual.arena());
}
@@ -867,6 +876,7 @@ TEST_F(ParseOverloadYamlTest, in_arena_noparser_4_2)
{
Tree actual;
parse_in_arena(filename, cyaml, actual.rootref());
ensure_compiler_knows_tree_was_changed(&actual);
test_compare(actual, ref);
check_tree(actual, actual.arena());
}
@@ -1131,6 +1141,7 @@ TEST_F(ParseOverloadJsonTest, in_arena_noparser_4_1)
{
Tree actual;
parse_json_in_arena(cjson, actual.rootref());
ensure_compiler_knows_tree_was_changed(&actual);
test_compare(actual, ref);
check_tree(actual, actual.arena());
}
@@ -1138,6 +1149,7 @@ TEST_F(ParseOverloadJsonTest, in_arena_noparser_4_2)
{
Tree actual;
parse_json_in_arena(filename, cjson, actual.rootref());
ensure_compiler_knows_tree_was_changed(&actual);
test_compare(actual, ref);
check_tree(actual, actual.arena());
}