-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b19916f
commit 8a44b6f
Showing
4 changed files
with
110 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/bash | ||
set -e | ||
|
||
if [ $# != 5 ]; then | ||
echo "Usage path/to/test-dynamic-section.sh <termux-elf-cleaner> <source-dir> <binary-name> <arch> <api>" | ||
exit 1 | ||
fi | ||
|
||
elf_cleaner="$1" | ||
source_dir="$2" | ||
binary_name="$3" | ||
arch="$4" | ||
api="$5" | ||
|
||
progname="$(basename "$elf_cleaner")" | ||
basefile="$source_dir/tests/$binary_name-$arch" | ||
origfile="$basefile-original" | ||
testfile="$basefile-api$api.test" | ||
expectedfile="$basefile-api$api-cleaned" | ||
|
||
if [ "$api" = "21" ]; then | ||
expected_logs="$progname: Removing version section from '$testfile' | ||
$progname: Removing version section from '$testfile' | ||
$progname: Removing the DT_RUNPATH dynamic section entry from '$testfile' | ||
$progname: Removing the DT_VERNEEDNUM dynamic section entry from '$testfile' | ||
$progname: Removing the DT_VERNEEDED dynamic section entry from '$testfile' | ||
$progname: Removing the DT_VERSYM dynamic section entry from '$testfile' | ||
$progname: Replacing unsupported DF_1_* flags 134217737 with 1 in '$testfile' | ||
$progname: Removing the DT_GNU_HASH dynamic section entry from '$testfile'" | ||
elif [ "$api" = "24" ]; then | ||
expected_logs="$progname: Replacing unsupported DF_1_* flags 134217737 with 9 in '$testfile'" | ||
else | ||
echo "Unknown API level $api" | ||
exit 1 | ||
fi | ||
|
||
cp "$origfile" "$testfile" | ||
if [ "$("$elf_cleaner" --api-level "$api" "$testfile")" != "$expected_logs" ]; then | ||
echo "Logs do not match for $testfile" | ||
exit 1 | ||
fi | ||
if not cmp -s "$testfile" "$expectedfile"; then | ||
echo "Expected and actual files differ for $testfile" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/bash | ||
set -e | ||
|
||
if [ $# != 4 ]; then | ||
echo "Usage path/to/test-dynamic-section.sh <termux-elf-cleaner> <source-dir> <binary-name> <arch>" | ||
exit 1 | ||
fi | ||
|
||
elf_cleaner="$1" | ||
source_dir="$2" | ||
binary_name="$3" | ||
arch="$4" | ||
|
||
progname="$(basename "$elf_cleaner")" | ||
basefile="$source_dir/tests/$binary_name-$arch" | ||
origfile="$basefile-original" | ||
testfile="$basefile.test" | ||
expectedfile="$basefile-tls-aligned" | ||
|
||
if [ "$arch" = "aarch64" ] || [ "$arch" = "x86_64" ]; then | ||
expected_logs="$progname: Changing TLS alignment for '$testfile' to 64, instead of 8" | ||
elif [ "$arch" = "arm" ] || [ "$arch" = "i686" ]; then | ||
expected_logs="$progname: Changing TLS alignment for '$testfile' to 32, instead of 8" | ||
else | ||
echo "Unknown architecture $arch" | ||
exit 1 | ||
fi | ||
|
||
cp "$origfile" "$testfile" | ||
if [ "$("$elf_cleaner" "$testfile")" != "$expected_logs" ]; then | ||
echo "Logs do not match for $testfile" | ||
exit 1 | ||
fi | ||
if not cmp -s "$testfile" "$expectedfile"; then | ||
echo "Expected and actual files differ for $testfile" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.