1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/version.sh

31 lines
742 B
Bash
Raw Normal View History

2021-03-01 07:49:39 +03:00
#!/bin/bash
set -e
2021-03-01 10:28:16 +03:00
cd $(dirname $0)
2021-03-01 07:49:39 +03:00
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/tmp/$(basename -s .sh $0)
mkdir -p $t
../mold -v | grep -Pq 'mold .*\; compatible with GNU ld and GNU gold\)'
../mold --version | grep -Pq 'mold .*\; compatible with GNU ld and GNU gold\)'
2021-03-01 07:49:39 +03:00
../mold -V | grep -Pq 'mold .*\; compatible with GNU ld and GNU gold\)'
2021-05-10 10:53:14 +03:00
../mold -V | grep -q elf_x86_64
../mold -V | grep -q elf_i386
2021-05-23 12:22:20 +03:00
cat <<EOF | clang -c -xc -o $t/a.o -
#include <stdio.h>
int main() {
printf("Hello world\n");
}
EOF
rm -f $t/exe
2021-05-23 12:22:20 +03:00
clang -fuse-ld=`pwd`/../mold -Wl,--version -o $t/exe $t/a.o | grep -q mold
! [ -f $t/exe ] || false
clang -fuse-ld=`pwd`/../mold -Wl,-v -o $t/exe $t/a.o | grep -q mold
2021-05-23 12:22:20 +03:00
$t/exe | grep -q 'Hello world'
2021-03-01 07:49:39 +03:00
echo OK