Skip to content

Commit a748eec

Browse files
committed
TEST=simple: Add support for tests which can generate multiple results.
Test is expected to write Output/TESTNAME.extra-results.txt, in the format: -- Result-FOO: NNN.NNNN Result-BAR: NNN.NNNN -- which we will then report as fake tests (with no compile info). Good enough for now, perhaps. git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@109844 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent de11172 commit a748eec

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

MultiSource/Examples/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# MultiSource/Examples Makefile: Build all subdirectories automatically
2+
3+
LEVEL = ../..
4+
5+
PARALLEL_DIRS = MultipleResults
6+
7+
include $(LEVEL)/Makefile.config
8+
include $(LEVEL)/Makefile.programs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
LEVEL = ../../../
2+
PROG = MultipleResults
3+
LDFLAGS =
4+
5+
include $(LEVEL)/Makefile.config
6+
7+
EXTRA_TEST_RESULTS_FILE := $(PROJ_OBJ_DIR)/Output/MultipleResults.extra-results.txt
8+
RUN_OPTIONS := $(EXTRA_TEST_RESULTS_FILE)
9+
10+
include ../../Makefile.multisrc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <stdio.h>
2+
#include <assert.h>
3+
4+
int main(int argc, char **argv) {
5+
assert(argc == 1);
6+
FILE *f = fopen(argv[1], "w");
7+
fprintf(f, "Result-A: %.2f\n", 0.1);
8+
fprintf(f, "Result-B: %.2f\n", 0.3);
9+
fclose(f);
10+
return 0;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exit 0

ParseMultipleResults

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
3+
import re
4+
import sys
5+
6+
def main():
7+
_,testname,path = sys.argv
8+
data = open(path).read()
9+
for result in re.finditer('Result-([^:]*): (.*)', data):
10+
name, value = result.groups()
11+
value = float(value)
12+
print
13+
print '-' * 62
14+
print ">>> ========= '%s.Subtest.%s' Program " % (testname, name)
15+
print '-' * 62
16+
print
17+
print 'TEST-PASS: exec %s.Subtest.%s' % (testname, name)
18+
print 'TEST-RESULT-exec-success: pass'
19+
print 'TEST-RESULT-exec-time: program %f' % value
20+
21+
if __name__ == '__main__':
22+
main()

TEST.simple.Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Output/%.simple.exec.report.txt: Output/%.exe-simple
5050
fi
5151
@-printf "TEST-RESULT-exec-time: " >> $@
5252
@-grep "^program" Output/$*.out-simple.time >> $@
53+
if test -f Output/$*.extra-results.txt; then \
54+
$(PROGDIR)/ParseMultipleResults $(RELDIR)/$* Output/$*.extra-results.txt >> $@; \
55+
fi
5356

5457
# Overall tests: just run subordinate tests
5558
$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \

0 commit comments

Comments
 (0)