Skip to content

Commit

Permalink
add thread tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thunder-coding committed Apr 3, 2024
1 parent 8a44b6f commit 28a3f22
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@ foreach(arch ${ARCHES})
${arch}
)
endforeach()

# Thread test
add_test(
NAME "thread"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-threads.sh
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)
32 changes: 32 additions & 0 deletions tests/test-threads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/bash

if [ $# != 2 ]; then
echo "Usage path/to/test-threads.sh <termux-elf-cleaner> <source-dir>"
exit 1
fi

elf_cleaner="$1"
source_dir="$2"

for i in {1..100}; do
for arch in aarch64 arm i686 x86_64; do
for api in 21 24; do
cp "$source_dir/tests/curl-7.83.1-$arch-original" "$source_dir/tests/curl-8.83.1-$arch-api$api-threads-$i.test"
done
done
done

for api in 21 24; do
"$elf_cleaner" --api-level "$api" --quiet --jobs 4 "$source_dir/tests/curl-8.83.1-"*"-api$api-threads"*".test"
done

for i in {1..100}; do
for arch in aarch64 arm i686 x86_64; do
for api in 21 24; do
if not cmp -s "$source_dir/tests/curl-7.83.1-$arch-api$api-cleaned" "$source_dir/tests/curl-8.83.1-$arch-api$api-threads-$i.test"; then
echo "Expected and actual files differ for $source_dir/tests/curl-8.83.1-$arch-threads-$i.test"
exit 1
fi
done
done
done

0 comments on commit 28a3f22

Please sign in to comment.