Skip to content

Commit

Permalink
test different generate-type modes outputs #589
Browse files Browse the repository at this point in the history
  • Loading branch information
CblPOK-git authored and akokoshn committed Apr 8, 2024
1 parent 81065ac commit 5d45e55
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ jobs:
cmake --build build -t cpp_examples_generate_tbl
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
Expand Down
20 changes: 20 additions & 0 deletions tests/compare_folders_content.sh
Original file line number Diff line number Diff line change
@@ -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."
11 changes: 11 additions & 0 deletions tests/copy_assigner_outputs.sh
Original file line number Diff line number Diff line change
@@ -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."
8 changes: 8 additions & 0 deletions tests/run_different_generation_modes_comparison.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rm -r build/examples/cpp
/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_tbl --
/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_crct --
bash tests/copy_assigner_outputs.sh build/2

bash tests/compare_folders_content.sh build/1 build/2

0 comments on commit 5d45e55

Please sign in to comment.