diff --git a/.github/workflows-in/embedded.ys b/.github/workflows-in/embedded.ys index 57949b32..88f70374 100644 --- a/.github/workflows-in/embedded.ys +++ b/.github/workflows-in/embedded.ys @@ -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 ) diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 1100313a..1c66e7f8 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -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()); }