forked from OSchip/llvm-project
[flang] Remove OS dependency in folding test
Original-commit: flang-compiler/f18@3728898ea9 Reviewed-on: https://github.com/flang-compiler/f18/pull/483 Tree-same-pre-rewrite: false
This commit is contained in:
parent
057b6875f7
commit
493cee5ca8
|
@ -135,6 +135,15 @@ add_test(RESHAPE reshape-test)
|
|||
add_test(ISO-binding ISO-Fortran-binding-test)
|
||||
add_test(folding folding-test)
|
||||
|
||||
set(TEST_LIBPGMATH "-pgmath=false")
|
||||
if (LIBPGMATH_DIR)
|
||||
find_library(LIBPGMATH pgmath PATHS ${LIBPGMATH_DIR})
|
||||
if(LIBPGMATH)
|
||||
set(TEST_LIBPGMATH "-pgmath=true")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(test ${FOLDING_TESTS})
|
||||
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test_folding.sh ${test})
|
||||
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test_folding.sh
|
||||
${test} ${TEST_LIBPGMATH})
|
||||
endforeach()
|
||||
|
|
|
@ -33,35 +33,16 @@
|
|||
# - test_x is not folded (it is neither .true. nor .false.). This means the
|
||||
# compiler could not fold the expression.
|
||||
|
||||
# Return ldd or similar tool to use to check for libpgmath
|
||||
function get_ldd() {
|
||||
case $(uname -s) in
|
||||
Linux) echo 'ldd' ;;
|
||||
Darwin) echo 'otool -L' ;;
|
||||
*)
|
||||
>&2 echo "Warning: cannot detect libpgmath on $(uname -s)"
|
||||
echo 'true' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
PATH=/usr/bin:/bin
|
||||
srcdir=$(dirname $0)
|
||||
F18CC=${F18:-../../tools/f18/f18}
|
||||
CMD="$F18CC -fdebug-dump-symbols -fparse-only"
|
||||
|
||||
# Check if libpgmath has been linked
|
||||
lpgmath=$($(get_ldd) $F18CC | grep "pgmath")
|
||||
if [ -z "$lpgmath" ]; then
|
||||
echo "Assuming no libpgmath support"
|
||||
else
|
||||
CMD="$CMD -DTEST_LIBPGMATH"
|
||||
echo "Assuming libpgmath support"
|
||||
fi
|
||||
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "Usage: $0 <fortran-source>"
|
||||
if [[ $# < 1 ]]; then
|
||||
echo "Usage: $0 <fortran-source> [-pgmath=<true/false>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
src=$srcdir/$1
|
||||
[[ ! -f $src ]] && echo "File not found: $src" && exit 1
|
||||
|
||||
|
@ -70,6 +51,12 @@ rm -rf $temp
|
|||
mkdir $temp
|
||||
[[ $KEEP ]] || trap "rm -rf $temp" EXIT
|
||||
|
||||
# Check if tests should assume folding is using libpgmath
|
||||
if [[ $# > 1 && "$2" = "-pgmath=true" ]]; then
|
||||
CMD="$CMD -DTEST_LIBPGMATH"
|
||||
echo "Assuming libpgmath support"
|
||||
fi
|
||||
|
||||
src1=$temp/symbols.log
|
||||
src2=$temp/all_parameters.log
|
||||
src3=$temp/tested_parameters.log
|
||||
|
|
Loading…
Reference in New Issue