root/mail-onna-stick/trunk/bin/run-texttest

Revision 301, 1.3 kB (checked in by t, 11 years ago)

more var/ stuff.

  • Property svn:executable set to *
Line 
1 #! /usr/bin/env python
2 import os
3 from cStringIO import StringIO
4 import shutil
5
6 import _mypath
7 print _mypath.home_dir
8 tests_location = os.path.join(_mypath.home_dir, 'tests/texttest/')
9 tests_location = os.path.abspath(tests_location)
10
11 print 'LOOKING FOR TESTS IN', tests_location
12
13 os.environ['TEXTTEST_HOME'] = tests_location
14 os.environ['MOS_HOME'] = _mypath.home_dir
15 os.environ['TEXTTEST_TMP'] = os.path.join(_mypath.home_dir, 'var/texttest')
16
17 import sys
18
19 # munge startup paths.
20
21 TEXTTEST_LOCATION=sys.argv[1]
22 sys.argv = [sys.argv[0], "-b", "default"]
23 sys.path.insert(0, os.path.realpath(TEXTTEST_LOCATION))
24
25 # initialize texttest stuff
26
27 from engine import TextTest
28 program = TextTest()
29
30 # capture output.
31 capture = StringIO()
32 oldout, sys.stdout = sys.stdout, capture
33
34 try:
35     program.run()
36 finally:
37     sys.stdout = oldout
38     output = capture.getvalue()
39     print output
40
41 vardir = os.path.join(_mypath.home_dir, 'var/texttest')
42
43 report = "(no report found)"
44 for root, dirs, files in os.walk(vardir):
45     if 'batchreport.mos' in files:
46         report = open(os.path.join(root, 'batchreport.mos')).read().strip()
47
48 print '\nFINAL REPORT:\n'
49 print '***'
50 print report
51 print '***'
52
53 if output.find('FAILED') != -1 or output.find("Could not find any matching application") != -1:
54     raise SystemExit(1)
55
56 sys.exit(0)
Note: See TracBrowser for help on using the browser.