#!/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 < $t/log grep -q 'undefined symbol: .*: _Z3fooii' $t/log ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-demangle 2> $t/log grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o 2> $t/log grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log cat < $t/log grep -q 'undefined symbol: .*: Pi' $t/log echo OK