From 729537c85661d2adbec776dc6638e21362120284 Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Wed, 3 Apr 2024 11:23:10 +0530 Subject: [PATCH] add thread tests --- CMakeLists.txt | 8 ++++++++ tests/test-threads.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 tests/test-threads.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index a205a35..bec1258 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} + ) diff --git a/tests/test-threads.sh b/tests/test-threads.sh new file mode 100755 index 0000000..a8bce47 --- /dev/null +++ b/tests/test-threads.sh @@ -0,0 +1,30 @@ +#!/usr/bin/bash + +if [ $# != 2 ]; then + echo "Usage path/to/test-threads.sh " + 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" "$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 + 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