diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 70432a0d..5e99931a 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -166,6 +166,23 @@ jobs: cmake --build build -t cpp_examples_generate_tbl_no_check ls -al ./build/examples/cpp + - name: Copy assigner output from separate generation mode + run: | + bash ./tests/copy_assigner_outputs.sh build/separate_generatuon + + - name: Run simultaneous .tbl and .crct generation of the C++ examples + run: | + cmake --build build -t cpp_examples_generate_both + ls -al ./build/examples/cpp + + - name: Copy assigner output from simultaneous generation mode + run: | + bash ./tests/copy_assigner_outputs.sh build/simultaneous_generation + + - name: Compare different assigner modes output + run: | + bash ./tests/compare_folders_content.sh build/separate_generatuon build/simultaneous_generation + - name: Run size estimation for C++ examples run: | cmake --build build -t cpp_examples_estimate_size diff --git a/tests/compare_folders_content.sh b/tests/compare_folders_content.sh new file mode 100755 index 00000000..13cab478 --- /dev/null +++ b/tests/compare_folders_content.sh @@ -0,0 +1,20 @@ +# check that the number of files in both directories is equal +count1=$(find "$1" -type f | wc -l) +count2=$(find "$2" -type f | wc -l) + +if [ "$count1" -eq "$count2" ]; then + echo "The number of files in both directories is equal." +else + echo "The number of files differs: $1 has $count1 files, $2 has $count2 files." + exit 1 +fi + +# Check that both directories contain identical list of files +diff -qr "$1" "$2" | grep 'Only in' && exit 1 +echo "Both directories contain files with the same names." + +diff -r "$1" "$2" +if [ $? -ne 0 ]; then + exit 1 +fi +echo "Comparison completed." diff --git a/tests/copy_assigner_outputs.sh b/tests/copy_assigner_outputs.sh new file mode 100755 index 00000000..049b58b3 --- /dev/null +++ b/tests/copy_assigner_outputs.sh @@ -0,0 +1,11 @@ +SRC_DIR="build/examples/cpp" +DEST_DIR="$1" + +if [ ! -d "$DEST_DIR" ]; then + mkdir -p "$DEST_DIR" +fi + +find "$SRC_DIR" -type f -name "*.crct*" -exec cp {} "$DEST_DIR" \; +find "$SRC_DIR" -type f -name "*.tbl*" -exec cp {} "$DEST_DIR" \; + +echo "All .crct and .tbl files have been copied from $SRC_DIR to $DEST_DIR." diff --git a/tests/run_different_generation_modes_comparison.sh b/tests/run_different_generation_modes_comparison.sh new file mode 100755 index 00000000..096be818 --- /dev/null +++ b/tests/run_different_generation_modes_comparison.sh @@ -0,0 +1,10 @@ +rm -r build/examples/cpp +rm -r build/1 +rm -r build/2 +/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_tbl_no_check -- +/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_crct -- +bash tests/copy_assigner_outputs.sh build/1 +/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_both_no_check -- +bash tests/copy_assigner_outputs.sh build/2 + +bash tests/compare_folders_content.sh build/1 build/2 \ No newline at end of file