You can do what you want by making your own lit.cfg script with additional definitions to do what you want. For example, I cross build stuff for different targets for my project, ELLCC. I use QEMU to run tests. Part of my modified lit.site.cfg looks like:
config.substitutions.append( ('%microblazeecc', ' ' + config.ecc + ' ' +
'-target microblaze-ellcc-linux ') )
config.substitutions.append( ('%microblazeexx', ' ' + config.ecc + '++ ' +
'-target microblaze-ellcc-linux ') )
config.substitutions.append( ('%microblazerun', ' ' + ellcc + '/bin/qemu-microblaze ') )
A typical test case looks like:
// Compile and run for every target.
// RUN: %armexx -o %t %s && %armrun %t | FileCheck -check-prefix=CHECK %s
// RUN: %armebexx -o %t %s && %armebrun %t | FileCheck -check-prefix=CHECK %s
// RUN: %i386exx -o %t %s && %i386run %t | FileCheck -check-prefix=CHECK %s
// RUN: %microblazeexx -o %t %s && %microblazerun %t | FileCheck -check-prefix=CHECK %s
// RUN: %mipsexx -o %t %s && %mipsrun %t | FileCheck -check-prefix=CHECK %s
// RUN: %mipselexx -o %t %s && %mipselrun %t | FileCheck -check-prefix=CHECK %s
// RUN: %ppcexx -o %t %s && %ppcrun %t | FileCheck -check-prefix=CHECK %s
// FAIL: %ppc64exx -o %t %s && %ppc64run %t | FileCheck -check-prefix=CHECK %s
// RUN: %x86_64exx -o %t %s && %x86_64run %t | FileCheck -check-prefix=CHECK %s
// CHECK: foo.i = 10
// CHECK: bye
#include <cstdio>
class Foo {
int i;
public:
Foo(int i) : i(i) { }
int get() { return i; }
~Foo() { printf("bye\n"); }
};
int main(int argc, char** argv)
{
Foo foo(10);
printf("foo.i = %d\n", foo.get());
}
You can use FileCheck to look for the output you're interested in.