Skip to content

Commit

Permalink
smaller test case
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Aug 19, 2024
1 parent 1ce0025 commit 69aec46
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 41 deletions.
92 changes: 51 additions & 41 deletions .github/workflows/rarearchs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,57 +113,67 @@ jobs:
time apt-get install kitware-archive-keyring
time apt-get update -y
fi
time apt-get install -y cmake cmake-data
time apt-get install -y cmake cmake-data python3
cmake --version
echo "install took $((SECONDS - start_time))"
echo "install took $((SECONDS - start_time))s"
run: |
set -xe
start_time=$SECONDS
uname -a
pwd
ls -lFhp .
#
# https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate
echo | c++ -O0 -Q -E -v - </dev/null 2>&1
echo | c++ -O0 -Q -c --help=optimizers --help=target
echo | c++ -O0 -dM -E - | sort
echo -----
echo | c++ -O1 -Q -E -v - </dev/null 2>&1
echo | c++ -O1 -Q -c --help=optimizers --help=target
echo | c++ -O1 -dM -E - | sort
echo -----
echo | c++ -O2 -Q -E -v - </dev/null 2>&1
echo | c++ -O2 -Q -c --help=optimizers --help=target
echo | c++ -O2 -dM -E - | sort
echo -----
echo | c++ -O3 -Q -E -v - </dev/null 2>&1
echo | c++ -O3 -Q -c --help=optimizers --help=target
echo | c++ -O3 -dM -E - | sort
echo =====
#
##
## https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate
#echo | c++ -O0 -Q -E -v - </dev/null 2>&1
#echo | c++ -O0 -Q -c --help=optimizers --help=target
#echo | c++ -O0 -dM -E - | sort
#echo -----
#echo | c++ -O1 -Q -E -v - </dev/null 2>&1
#echo | c++ -O1 -Q -c --help=optimizers --help=target
#echo | c++ -O1 -dM -E - | sort
#echo -----
#echo | c++ -O2 -Q -E -v - </dev/null 2>&1
#echo | c++ -O2 -Q -c --help=optimizers --help=target
#echo | c++ -O2 -dM -E - | sort
#echo -----
#echo | c++ -O3 -Q -E -v - </dev/null 2>&1
#echo | c++ -O3 -Q -c --help=optimizers --help=target
#echo | c++ -O3 -dM -E - | sort
#echo =====
##
bdir=build_${{matrix.arch}}_${{matrix.bt}}_${{matrix.std}}
idir=install_${{matrix.arch}}_${{matrix.bt}}_${{matrix.std}}
mkdir -p $bdir
#
cmd="cmake -S . -B $bdir \
-DCMAKE_INSTALL_PREFIX=$idir \
-DCMAKE_BUILD_TYPE=${{matrix.bt}} \
-DC4_CXX_STANDARD=${{matrix.std}} \
-DCXX_STANDARD=${{matrix.std}} \
-DRYML_DEV=ON \
-DRYML_TEST_SUITE=ON \
-DRYML_BUILD_BENCHMARKS=OFF \
-DRYML_SANITIZE=OFF \
-DRYML_LINT=OFF \
-DRYML_VALGRIND=OFF"
echo $cmd
cd samples/singleheader
mkdir -p $bdir
if [ -z "${{matrix.cxxflags}}" ] ; then
time $cmd
time cmake -S . -B $bdir -DCMAKE_BUILD_TYPE=${{matrix.bt}}
else
time $cmd -DCMAKE_CXX_FLAGS_RELEASE:STRING="${{matrix.cxxflags}}"
time cmake -S . -B $bdir -DCMAKE_BUILD_TYPE=${{matrix.bt}} \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="${{matrix.cxxflags}}"
fi
#
time cmake --build $bdir --verbose -j 4 --target ryml-test-build
#
time cmake --build $bdir --target ryml-test-run
echo "run took $((SECONDS - start_time))"
cmake --build $bdir --config ${{matrix.bt}} -j 3 --target run
##
#mkdir -p $bdir
#cmd="cmake -S . -B $bdir \
# -DCMAKE_INSTALL_PREFIX=$idir \
# -DCMAKE_BUILD_TYPE=${{matrix.bt}} \
# -DC4_CXX_STANDARD=${{matrix.std}} \
# -DCXX_STANDARD=${{matrix.std}} \
# -DRYML_DEV=ON \
# -DRYML_TEST_SUITE=ON \
# -DRYML_BUILD_BENCHMARKS=OFF \
# -DRYML_SANITIZE=OFF \
# -DRYML_LINT=OFF \
# -DRYML_VALGRIND=OFF"
#echo $cmd
#if [ -z "${{matrix.cxxflags}}" ] ; then
# time $cmd
#else
# time $cmd -DCMAKE_CXX_FLAGS_RELEASE:STRING="${{matrix.cxxflags}}"
#fi
##
#time cmake --build $bdir --verbose -j 4 --target ryml-test-build
##
#time cmake --build $bdir --target ryml-test-run
echo "run took $((SECONDS - start_time))s"
5 changes: 5 additions & 0 deletions samples/quickstart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ int report_checks();

int main()
{
sample::sample_json();
#ifdef WTF
sample::sample_lightning_overview();
sample::sample_quick_overview();
sample::sample_substr();
Expand Down Expand Up @@ -113,6 +115,7 @@ int main()
sample::sample_per_tree_allocator();
sample::sample_static_trees();
sample::sample_location_tracking();
#endif
return sample::report_checks();
}

Expand Down Expand Up @@ -4286,11 +4289,13 @@ void sample_json()
// has a smaller grammar:
ryml::Tree json_tree = ryml::parse_json_in_arena(json);
// to emit JSON, use the proper overload:
std::cout << "WTF1:\n" << ryml::emitrs_json<std::string>(tree);
CHECK(ryml::emitrs_json<std::string>(tree) == R"({"doe": "a deer, a female deer","ray": "a drop of golden sun","me": "a name, I call myself","far": "a long long way to go"})");
CHECK(ryml::emitrs_json<std::string>(json_tree) == R"({"doe": "a deer, a female deer","ray": "a drop of golden sun","me": "a name, I call myself","far": "a long long way to go"})");
// to emit JSON to a stream:
std::stringstream ss;
ss << ryml::as_json(tree); // <- mark it like this
std::cout << "WTF2:\n" << ss.str();
CHECK(ss.str() == R"({"doe": "a deer, a female deer","ray": "a drop of golden sun","me": "a name, I call myself","far": "a long long way to go"})");
// Note the following limitations:
//
Expand Down

0 comments on commit 69aec46

Please sign in to comment.