From a60a18880ecd3549aaafbb199abb6d159a4941a1 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Thu, 19 Dec 2019 16:14:10 +0200 Subject: testing: added a configure check for ASM tests Addded a configure check to see if the ASM tests are appropriate. If we can build a basic ASM file with .rodata references, assume we can run the tests. --- configure.ac | 44 ++++++++++++++++++++++++++++++++++++++++++-- test/ragel.d/gentests.sh | 3 ++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1d34b74e..88d8493c 100644 --- a/configure.ac +++ b/configure.ac @@ -262,19 +262,58 @@ AC_PATH_PROG([RUST_BIN], [rustc]) AC_PATH_PROG([JULIA_BIN], [julia]) AC_PATH_PROG([GNUSTEP_CONFIG], [gnustep-config]) +dnl +dnl Julia requires a large virtual address space. On systems where this is +dnl limited by ulimit, julia will fail to run. +dnl + if test "x$JULIA_BIN" != x; then - echo -n "checking if julia is able to run programs ... " echo 'println( "can run julia programs" );' > conftest.jl + echo -n "checking if julia is able to run programs ... " if sh -c "$JULIA_BIN conftest.jl" >>config.log 2>&1; then echo "yes" else - echo "FAILED to run julia program" >> config.log echo "no" JULIA_BIN="" fi rm -f conftest.jl fi +dnl +dnl The ASM tests have been based off of sources that are non-relocatable +dnl These won't assemble on some systems (with the right architecture). Check +dnl our specific flavour of ASM now so we can avoid some test failures. +dnl + +ASM_BIN=$CC + +cat <<\EOF > conftest.s +.section .rodata +.L_works: +.string "works" + +.text +.globl main +main: + pushq %rbp + movq %rsp, %rbp + pushq %rdi + movq $.L_works, %rdi + call puts + popq %rdi + mov $0, %rax + ret +EOF + +echo -n "checking if ragel ASM tests will build ... " +if sh -c "$ASM_BIN -o conftest.bin conftest.s" >>config.log 2>&1; then + echo "yes" +else + echo "no" + ASM_BIN="" +fi +rm -f conftest.s + SED_SUBST="$SED_SUBST -e 's|@D_BIN@|${D_BIN}|g'" SED_SUBST="$SED_SUBST -e 's|@JAVAC_BIN@|${JAVAC_BIN}|g'" SED_SUBST="$SED_SUBST -e 's|@RUBY_BIN@|${RUBY_BIN}|g'" @@ -284,6 +323,7 @@ SED_SUBST="$SED_SUBST -e 's|@OCAML_BIN@|${OCAML_BIN}|g'" SED_SUBST="$SED_SUBST -e 's|@RUST_BIN@|${RUST_BIN}|g'" SED_SUBST="$SED_SUBST -e 's|@JULIA_BIN@|${JULIA_BIN}|g'" SED_SUBST="$SED_SUBST -e 's|@GNUSTEP_CONFIG@|${GNUSTEP_CONFIG}|g'" +SED_SUBST="$SED_SUBST -e 's|@ASM_BIN@|${ASM_BIN}|g'" AC_ARG_WITH(crack, [AC_HELP_STRING([--with-crack], [location of crack install])], diff --git a/test/ragel.d/gentests.sh b/test/ragel.d/gentests.sh index 941ef448..86c81da2 100644 --- a/test/ragel.d/gentests.sh +++ b/test/ragel.d/gentests.sh @@ -108,6 +108,7 @@ rust_compiler="@RUST_BIN@" crack_interpreter="@CRACK_BIN@" julia_interpreter="@JULIA_BIN@" gnustep_config="@GNUSTEP_CONFIG@" +assembler="@ASM_BIN@" if [ -z "$gnustep_config" ]; then objc_compiler="" @@ -260,7 +261,7 @@ function lang_opts() lang_opt="--asm" code_suffix=s interpreted=false - compiler="gcc" + compiler="$assembler" host_ragel=$RAGEL_ASM_BIN flags="" libs="" -- cgit v1.2.1