tools build issue with lnt in cross platform testing

I want to get lnt to use qemu for the execution.

In that case, RHOST= is not set.

But I change the Arch because I am going to run in cross mode.

Then I'm setting RUNUNDER to be a script which runs qemu.

In this case it builds timeit-target as a Mips which fails because this is running on x86.

~/mysandbox/bin/lnt runtest nt --sandbox ~/mysandbox --cc /local/llvmpb_a/install/bin/clang --cflag "-target mipsel-linux-gnu -EL -mips16 -gcc-toolchain /mips/arch/overflow/codesourcery/mips-linux-gnu/pro/release/2011.09-90/Linux -fPIC" --test-suite ~/workspace/test-suite -j 1 --only-test SingleSource/UnitTests/Mips --make-param=MIPSARCH=mips16 --llvm-arch=Mips --make-param=RUNUNDER=/home/rkotler/test-suite/qemusample/qemueluser.sh

Seems like this is just a bug in the rules for building the tools but maybe there is a way around this?

One other thing is that I'm using a script for RUNUNDER but would like to just invoke qemu and pass the parameters through lnt. Is there a way to do this?

The issues seems to be this line in the tools Makefile

timeit-target: timeit.c
  $(LD_ENV_OVERRIDES) $(LCC) -o $@ $< $(LDFLAGS) $(CFLAGS) $(TARGET_FLAGS) -O3

It should not add target flags if we are simulating the target on the host.

By running the make for the tools and removing the target flags from
that and then run the make for the test, everything worked.

I'm not sure the cleanest way to fix the Makefile in the tools directory so that it does not add target flags when you want to use this with a simulator.

make "tools" "TARGET_LLVMGCC=/local/llvmpb_a/install/bin/clang"
"TARGET_CXX=None" "LLI_OPTFLAGS=-O3" "TARGET_CC=None"
"TARGET_LLVMGXX=/local/llvmpb_a/install/bin/clang++"
"CC_UNDER_TEST_IS_CLANG=1" "TEST=simple" "USE_REFERENCE_OUTPUT=1"
"CC_UNDER_TEST_TARGET_IS_X86_64=1" "OPTFLAGS=-O3" "LLC_OPTFLAGS=-O3"
"ENABLE_OPTIMIZED=1" "ENABLE_HASHED_PROGRAM_OUTPUT=1" "DISABLE_JIT=1

"make" "-k" "TARGET_LLVMGCC=/local/llvmpb_a/install/bin/clang"
"TARGET_CXX=None" "LLI_OPTFLAGS=-O3" "TARGET_CC=None"
"TARGET_LLVMGXX=/local/llvmpb_a/install/bin/clang++"
"RUNUNDER=/home/rkotler/test-suite/qemusample/qemueluser.sh"
"CC_UNDER_TEST_IS_CLANG=1" "TEST=simple" "TARGET_FLAGS=-target
mipsel-linux-gnu -EL -mips16 -gcc-toolchain
/mips/arch/overflow/codesourcery/mips-linux-gnu/pro/release/2011.09-90/Linux

-fPIC" "USE_REFERENCE_OUTPUT=1" "CC_UNDER_TEST_TARGET_IS_X86_64=1"
"OPTFLAGS=-O3" "MIPSARCH=mips16" "LLC_OPTFLAGS=-O3" "ENABLE_OPTIMIZED=1"
"ARCH=Mips" "ENABLE_HASHED_PROGRAM_OUTPUT=1" "DISABLE_JIT=1" "-C"
"SingleSource/UnitTests/Mips" "-j" "1" "report" "report.simple.csv"