1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-26 01:44:29 +03:00
mold/test/run.sh

42 lines
980 B
Bash
Raw Normal View History

2021-03-25 12:38:25 +03:00
#!/bin/bash
set -e
cd $(dirname $0)
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/tmp/$(basename -s .sh $0)
mkdir -p $t
cat <<'EOF' | cc -xc -c -o $t/a.o -
#include <stdio.h>
int main() {
printf("Hello\n");
return 0;
}
EOF
gcc -fuse-ld=bfd -o $t/exe $t/a.o
2021-03-25 12:38:25 +03:00
readelf -p .comment $t/exe > $t/log
2021-04-11 07:58:49 +03:00
! grep -q mold $t/log || false
2021-03-25 12:38:25 +03:00
clang -fuse-ld=bfd -o $t/exe $t/a.o
2021-03-25 12:38:25 +03:00
readelf -p .comment $t/exe > $t/log
2021-04-11 07:58:49 +03:00
! grep -q mold $t/log || false
2021-03-25 12:38:25 +03:00
2021-06-04 14:32:58 +03:00
LD_PRELOAD=`pwd`/../mold-wrapper.so MOLD_PATH=`pwd`/../mold \
gcc -o $t/exe $t/a.o -B/usr/bin
2021-03-25 12:38:25 +03:00
readelf -p .comment $t/exe > $t/log
2021-04-10 17:08:55 +03:00
grep -q mold $t/log
2021-03-25 12:38:25 +03:00
2021-06-04 14:32:58 +03:00
LD_PRELOAD=`pwd`/../mold-wrapper.so MOLD_PATH=`pwd`/../mold \
clang -o $t/exe $t/a.o -fuse-ld=/usr/bin/ld
2021-03-25 12:38:25 +03:00
readelf -p .comment $t/exe > $t/log
2021-04-10 17:08:55 +03:00
grep -q mold $t/log
2021-03-25 12:38:25 +03:00
2021-06-04 14:32:58 +03:00
../mold -run env | grep -q '^MOLD_PATH=.*/mold$'
2021-05-14 16:55:04 +03:00
../mold -run /usr/bin/ld --version | grep -q mold
../mold -run /usr/bin/ld.lld --version | grep -q mold
../mold -run /usr/bin/ld.gold --version | grep -q mold
2021-05-14 16:55:04 +03:00
2021-03-25 12:38:25 +03:00
echo OK