diff --git a/.github/workflows/attach_termux_elf_cleaner_to_release.yml b/.github/workflows/attach_termux_elf_cleaner_to_release.yml
index 7ae5261..3135f70 100644
--- a/.github/workflows/attach_termux_elf_cleaner_to_release.yml
+++ b/.github/workflows/attach_termux_elf_cleaner_to_release.yml
@@ -22,12 +22,18 @@ jobs:
echo "The versionName '${RELEASE_VERSION_NAME/v/}' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html."
exit 1
fi
+ - name: Install required packages
+ run: |
+ sudo apt update
+ sudo apt upgrade
+ sudo apt install cmake ninja-build
- name: Build
run: |
- autoreconf -vfi
- mkdir build && cd build
- ../configure
- make
+ cmake . -Bbuild -GNinja
+ ninja -C build/
+ - name: Test
+ run: |
+ ninja -C build/ test
- name: Attach termux-elf-cleaner to release
uses: termux/upload-release-action@v4.1.0
with:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8b3fd6f..8de0a08 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,22 +12,15 @@ jobs:
with:
ref: ${{ env.GITHUB_REF }}
- - name: Prepare
+ - name: Install required packages
run: |
- autoreconf -vfi
- mkdir build
-
- - name: Configure
- run: |
- cd build
- ../configure
-
- - name: Make
+ sudo apt update
+ sudo apt upgrade
+ sudo apt install cmake ninja-build
+ - name: Build
run: |
- cd build
- make
-
+ cmake . -Bbuild -GNinja
+ ninja -C build/
- name: Test
run: |
- cd build
- make check
+ ninja -C build/ test
diff --git a/.gitignore b/.gitignore
index 1354835..0328db1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,16 @@ elf-cleaner
# In case of out-of-src build in a directory build/:
build/
+# Some people prefer to use this as build directory
+out/
+
+# Used for editor integration (completions, etc)
+compile_commands.json
+
*~
+# Generated files from old autotools
+# Although we no longer use autotools, some contributors might still be having it in their trees
Makefile.in
aclocal.m4
autom4te.cache/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..a4fb37c
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
+
+set(VERSION_MAJOR 3)
+set(VERSION_MINOR 0)
+set(VERSION_PATCH 0)
+
+set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+
+set(ARCHES aarch64;arm;i686;x86_64)
+set(APIS 21;24)
+
+project(elf-cleaner
+ LANGUAGES C CXX
+ VERSION ${VERSION}
+)
+
+set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+set(PACKAGE_NAME "termux-elf-cleaner" CACHE STRING "Name of the package")
+
+add_executable("${PACKAGE_NAME}"
+ elf-cleaner.cpp
+ arghandling.c
+)
+
+target_compile_definitions("${PACKAGE_NAME}"
+ PRIVATE "COPYRIGHT=\"Copyright (C) 2022-2024 Termux and contributors.\""
+ PRIVATE "PACKAGE_VERSION=\"${VERSION}\""
+ PRIVATE "PACKAGE_NAME=\"${PACKAGE_NAME}\""
+)
+
+enable_testing()
+add_test(
+ NAME "tests"
+ COMMAND bash -c "${CMAKE_CURRENT_SOURCE_DIR}/tests/test.sh ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}"
+ )
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index e24ec7b..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with termux-elf-cleaner. If not, see
-# .
-
-SUBDIRS = tests
-AM_CXXFLAGS = -std=c++20 -Wall -Wextra -pedantic -pthread
-
-bin_PROGRAMS = termux-elf-cleaner
-
-termux_elf_cleaner_SOURCES = elf-cleaner.cpp arghandling.c
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index f8d6692..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl Autoconf script for termux-elf-cleaner
-dnl To rebuild the 'configure' script from this, execute the command
-dnl autoconf
-dnl in the directory containing this script.
-dnl
-dnl Copyright (C) 2022-2023 Termux
-dnl
-dnl This file is part of termux-elf-cleaner.
-dnl
-dnl termux-elf-cleaner is free software: you can redistribute it
-dnl and/or modify it under the terms of the GNU General Public
-dnl License as published by the Free Software Foundation, either
-dnl version 3 of the License, or (at your option) any later version.
-dnl
-dnl termux-elf-cleaner is distributed in the hope that it will be
-dnl useful, but WITHOUT ANY WARRANTY; without even the implied
-dnl warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-dnl See the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with termux-elf-cleaner. If not, see
-dnl .
-
-AC_PREREQ([2.69])
-AC_INIT([termux-elf-cleaner], [2.2.1], [support@termux.dev])
-
-AM_INIT_AUTOMAKE([foreign])
-
-AC_PROG_MAKE_SET
-AC_PROG_CC
-AC_PROG_CXX
-AC_LANG(C++)
-
-copyright="Copyright (C) 2022-2023 Termux."
-AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
- [Short copyright string for this version of termux-elf-cleaner.])
-
-AC_CONFIG_TESTDIR(tests)
-AM_MISSING_PROG([AUTOM4TE], [autom4te])
-
-AC_CONFIG_FILES([Makefile tests/Makefile tests/atlocal])
-
-AC_OUTPUT
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..9ed3b07
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1 @@
+*.test
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index e2e661b..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# Makefile for termux-elf-cleaner regression tests.
-
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-TESTSUITE_FRAGMENTS = api-21.at api-24.at tls-alignment.at \
-elf-cleaner.at threads.at
-
-EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
-
-DISTCLEANFILES = atconfig $(check_SCRIPTS)
-MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
-CLEANFILES =
-
-## ------------ ##
-## package.m4. ##
-## ------------ ##
-
-$(builddir)/package.m4: $(top_srcdir)/configure.ac
- { \
- echo '# Signature of the current package.'; \
- echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
- echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
- echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
- echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
- } >$(builddir)/package.m4
-
-## ------------ ##
-## Test suite. ##
-## ------------ ##
-
-TESTSUITE_AT = elf-cleaner.at
-
-TESTSUITE = $(builddir)/testsuite
-
-AUTOTEST = $(AUTOM4TE) --language=autotest
-$(TESTSUITE): package.m4 $(TESTSUITE_FRAGMENTS) $(TESTSUITE_AT)
- $(AUTOTEST) -I$(srcdir) $(TESTSUITE_AT) -o $@.tmp
- mv $@.tmp $@
-
-clean-local:
- test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
-
-check-local: $(TESTSUITE) atlocal
- $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
-
-check-full:
- FULL_TEST=1 $(MAKE) check
diff --git a/tests/api-21.at b/tests/api-21.at
deleted file mode 100644
index fb75596..0000000
--- a/tests/api-21.at
+++ /dev/null
@@ -1,109 +0,0 @@
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
-
-# Test suite for termux-elf-cleaner.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-# Ensure that programs cleaned for api level 21 have the DT_FLAGS we
-# expect
-
-AT_BANNER([API level 21])
-
-AT_SETUP([aarch64])
-AT_KEYWORDS([dynamic-section api-21 aarch64])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-aarch64-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 21 curl-7.83.1-aarch64-original],
-[0],
-[AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing the DT_RUNPATH dynamic section entry from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDNUM dynamic section entry from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDED dynamic section entry from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing the DT_VERSYM dynamic section entry from 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 1 in 'curl-7.83.1-aarch64-original'
-AT_PACKAGE_NAME: Removing the DT_GNU_HASH dynamic section entry from 'curl-7.83.1-aarch64-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-aarch64-original ${top_srcdir}/tests/curl-7.83.1-aarch64-api21-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([arm])
-AT_KEYWORDS([dynamic-section api-21 arm])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-arm-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 21 curl-7.83.1-arm-original],
-[0],
-[AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing the DT_RUNPATH dynamic section entry from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDNUM dynamic section entry from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDED dynamic section entry from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing the DT_VERSYM dynamic section entry from 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 1 in 'curl-7.83.1-arm-original'
-AT_PACKAGE_NAME: Removing the DT_GNU_HASH dynamic section entry from 'curl-7.83.1-arm-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-arm-original ${top_srcdir}/tests/curl-7.83.1-arm-api21-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([i686])
-AT_KEYWORDS([dynamic-section api-21 i686])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-i686-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 21 curl-7.83.1-i686-original],
-[0],
-[AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing the DT_RUNPATH dynamic section entry from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDNUM dynamic section entry from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDED dynamic section entry from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing the DT_VERSYM dynamic section entry from 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 1 in 'curl-7.83.1-i686-original'
-AT_PACKAGE_NAME: Removing the DT_GNU_HASH dynamic section entry from 'curl-7.83.1-i686-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-i686-original ${top_srcdir}/tests/curl-7.83.1-i686-api21-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([x86_64])
-AT_KEYWORDS([dynamic-section api-21 x86_64])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-x86_64-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 21 curl-7.83.1-x86_64-original],
-[0],
-[AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing version section from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing the DT_RUNPATH dynamic section entry from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDNUM dynamic section entry from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing the DT_VERNEEDED dynamic section entry from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing the DT_VERSYM dynamic section entry from 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 1 in 'curl-7.83.1-x86_64-original'
-AT_PACKAGE_NAME: Removing the DT_GNU_HASH dynamic section entry from 'curl-7.83.1-x86_64-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-x86_64-original ${top_srcdir}/tests/curl-7.83.1-x86_64-api21-cleaned
-],
-[0],
-[])
-AT_CLEANUP
diff --git a/tests/api-24.at b/tests/api-24.at
deleted file mode 100644
index 318aef4..0000000
--- a/tests/api-24.at
+++ /dev/null
@@ -1,81 +0,0 @@
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
-
-# Test suite for termux-elf-cleaner.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-# Ensure that programs cleaned for api level 24 have the DT_FLAGS we
-# expect
-
-AT_BANNER([API level 24])
-
-AT_SETUP([aarch64])
-AT_KEYWORDS([dynamic-section api-24 aarch64])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-aarch64-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 24 curl-7.83.1-aarch64-original],
-[0],
-[AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 9 in 'curl-7.83.1-aarch64-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-aarch64-original ${top_srcdir}/tests/curl-7.83.1-aarch64-api24-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([arm])
-AT_KEYWORDS([dynamic-section api-24 arm])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-arm-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 24 curl-7.83.1-arm-original],
-[0],
-[AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 9 in 'curl-7.83.1-arm-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-arm-original ${top_srcdir}/tests/curl-7.83.1-arm-api24-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([i686])
-AT_KEYWORDS([dynamic-section api-24 i686])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-i686-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 24 curl-7.83.1-i686-original],
-[0],
-[AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 9 in 'curl-7.83.1-i686-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-i686-original ${top_srcdir}/tests/curl-7.83.1-i686-api24-cleaned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([x86_64])
-AT_KEYWORDS([dynamic-section api-24 x86_64])
-AT_CHECK([cp ${top_srcdir}/tests/curl-7.83.1-x86_64-original .
-${abs_top_builddir}/termux-elf-cleaner --api-level 24 curl-7.83.1-x86_64-original],
-[0],
-[AT_PACKAGE_NAME: Replacing unsupported DF_1_* flags 134217737 with 9 in 'curl-7.83.1-x86_64-original'
-])
-AT_CHECK([
-cmp --silent curl-7.83.1-x86_64-original ${top_srcdir}/tests/curl-7.83.1-x86_64-api24-cleaned
-],
-[0],
-[])
-AT_CLEANUP
diff --git a/tests/atlocal.in b/tests/atlocal.in
deleted file mode 100644
index c9f322d..0000000
--- a/tests/atlocal.in
+++ /dev/null
@@ -1,21 +0,0 @@
-# @configure_input@ -*- shell-script -*-
-# Configurable variable values for termux-elf-cleaner test suite.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-PATH=@abs_builddir@:@abs_top_builddir@:$top_srcdir:$srcdir:$PATH
diff --git a/tests/elf-cleaner.at b/tests/elf-cleaner.at
deleted file mode 100644
index fb1b140..0000000
--- a/tests/elf-cleaner.at
+++ /dev/null
@@ -1,33 +0,0 @@
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
-
-# Test suite for termux-elf-cleaner.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-
-AT_INIT
-AT_TESTED([termux-elf-cleaner])
-AT_COLOR_TESTS
-
-m4_include([api-21.at])
-
-m4_include([api-24.at])
-
-m4_include([tls-alignment.at])
-
-m4_include([threads.at])
diff --git a/tests/test.sh b/tests/test.sh
new file mode 100755
index 0000000..439c59d
--- /dev/null
+++ b/tests/test.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/bash
+set -e
+if [ $# != 2 ]; then
+ echo "Usage path/to/test.sh "
+ exit 1
+fi
+
+archs=('arm' 'aarch64' 'i686' 'x86_64')
+apis=('21' '24')
+
+for arch in "${archs[@]}"; do
+ for api in "${apis[@]}"; do
+ basefile="$2/tests/curl-7.83.1-${arch}"
+ if [ "${api}" = "21" ]; then
+ expected_logs="termux-elf-cleaner: Removing version section from '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing version section from '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing the DT_RUNPATH dynamic section entry from '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing the DT_VERNEEDNUM dynamic section entry from '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing the DT_VERNEEDED dynamic section entry from '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing the DT_VERSYM dynamic section entry from '${basefile}-api${api}.test'
+termux-elf-cleaner: Replacing unsupported DF_1_* flags 134217737 with 1 in '${basefile}-api${api}.test'
+termux-elf-cleaner: Removing the DT_GNU_HASH dynamic section entry from '${basefile}-api${api}.test'"
+ elif [ "${api}" = "24" ]; then
+ expected_logs="termux-elf-cleaner: Replacing unsupported DF_1_* flags 134217737 with 9 in '${basefile}-api${api}.test'"
+ else
+ echo "Unknown API level ${api}"
+ exit 1
+ fi
+ cp "${basefile}"{-original,"-api${api}".test}
+ if [ "$("$1" --api-level "${api}" "${basefile}-api${api}.test")" != "${expected_logs}" ]; then
+ echo "Failed to remove version section from ${basefile}-api${api}.test"
+ exit 1
+ fi
+ done
+done
+
+for arch in "${archs[@]}"; do
+ basefile="$2/tests/valgrind-3.19.0-${arch}"
+ cp "${basefile}"{-original,.test}
+ if [ "${arch}" = "aarch64" ] || [ "${arch}" = "x86_64" ]; then
+ expected_logs="termux-elf-cleaner: Changing TLS alignment for '${basefile}.test' to 64, instead of 8"
+ elif [ "${arch}" = "arm" ] || [ "${arch}" = "i686" ]; then
+ expected_logs="termux-elf-cleaner: Changing TLS alignment for '${basefile}.test' to 32, instead of 8"
+ else
+ echo "Unknown architecture ${arch}"
+ exit 1
+ fi
+ if [ "$("$1" "${basefile}.test")" != "${expected_logs}" ]; then
+ echo "Failed to remove version section from ${basefile}.test"
+ exit 1
+ fi
+ diff "${basefile}"{-tls-aligned,.test}
+done
diff --git a/tests/threads.at b/tests/threads.at
deleted file mode 100644
index a9ff45b..0000000
--- a/tests/threads.at
+++ /dev/null
@@ -1,39 +0,0 @@
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
-
-# Test suite for termux-elf-cleaner.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-# Ensure that termux-elf-cleaner can run on several threads
-
-AT_BANNER([Multiple threads])
-
-AT_SETUP([Parallel on 100 files])
-AT_KEYWORDS([dynamic-section api-24 aarch64])
-AT_CHECK([
-for i in $(seq 1 100); do
- cp ${top_srcdir}/tests/curl-7.83.1-aarch64-original curl-7.83.1-aarch64-original-$i
-done
-${abs_top_builddir}/termux-elf-cleaner --api-level 24 --quiet --jobs 4 curl-7.83.1-aarch64-original-*
-for i in $(seq 1 100); do
- cmp --silent curl-7.83.1-aarch64-original-$i ${top_srcdir}/tests/curl-7.83.1-aarch64-api24-cleaned
-done
-],
-[0],
-[])
-AT_CLEANUP
diff --git a/tests/tls-alignment.at b/tests/tls-alignment.at
deleted file mode 100644
index 893a498..0000000
--- a/tests/tls-alignment.at
+++ /dev/null
@@ -1,81 +0,0 @@
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
-
-# Test suite for termux-elf-cleaner.
-# Copyright 2022 Termux
-
-# This file is part of termux-elf-cleaner.
-
-# termux-elf-cleaner is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-
-# termux-elf-cleaner is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# .
-
-# Ensure that patching of under-aligned TLS segment in program header
-# works
-
-AT_BANNER([TLS segment alignment])
-
-AT_SETUP([aarch64])
-AT_KEYWORDS([program-header TLS aarch64])
-AT_CHECK([cp ${top_srcdir}/tests/valgrind-3.19.0-aarch64-original .
-${abs_top_builddir}/termux-elf-cleaner valgrind-3.19.0-aarch64-original],
-[0],
-[AT_PACKAGE_NAME: Changing TLS alignment for 'valgrind-3.19.0-aarch64-original' to 64, instead of 8
-])
-AT_CHECK([
-cmp --silent valgrind-3.19.0-aarch64-original ${top_srcdir}/tests/valgrind-3.19.0-aarch64-tls-aligned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([arm])
-AT_KEYWORDS([program-header TLS arm])
-AT_CHECK([cp ${top_srcdir}/tests/valgrind-3.19.0-arm-original .
-${abs_top_builddir}/termux-elf-cleaner valgrind-3.19.0-arm-original],
-[0],
-[AT_PACKAGE_NAME: Changing TLS alignment for 'valgrind-3.19.0-arm-original' to 32, instead of 8
-])
-AT_CHECK([
-cmp --silent valgrind-3.19.0-arm-original ${top_srcdir}/tests/valgrind-3.19.0-arm-tls-aligned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([i686])
-AT_KEYWORDS([program-header TLS i686])
-AT_CHECK([cp ${top_srcdir}/tests/valgrind-3.19.0-i686-original .
-${abs_top_builddir}/termux-elf-cleaner valgrind-3.19.0-i686-original],
-[0],
-[AT_PACKAGE_NAME: Changing TLS alignment for 'valgrind-3.19.0-i686-original' to 32, instead of 8
-])
-AT_CHECK([
-cmp --silent valgrind-3.19.0-i686-original ${top_srcdir}/tests/valgrind-3.19.0-i686-tls-aligned
-],
-[0],
-[])
-AT_CLEANUP
-
-AT_SETUP([x86_64])
-AT_KEYWORDS([program-header TLS x86_64])
-AT_CHECK([cp ${top_srcdir}/tests/valgrind-3.19.0-x86_64-original .
-${abs_top_builddir}/termux-elf-cleaner valgrind-3.19.0-x86_64-original],
-[0],
-[AT_PACKAGE_NAME: Changing TLS alignment for 'valgrind-3.19.0-x86_64-original' to 64, instead of 8
-])
-AT_CHECK([
-cmp --silent valgrind-3.19.0-x86_64-original ${top_srcdir}/tests/valgrind-3.19.0-x86_64-tls-aligned
-],
-[0],
-[])
-AT_CLEANUP