Print test name rather than the path to executable.

pull/15/head
Jussi Pakkanen 11 years ago
parent f5f2ddde7e
commit 3b698f40df
  1. 13
      backends.py
  2. 18
      meson_test.py

@ -443,11 +443,18 @@ class NinjaBackend(Backend):
velem.add_item('DESC', 'Running test suite under Valgrind.')
velem.write(outfile)
datafile = open(test_data, 'w')
for t in self.build.get_tests():
datafile.write(os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe())) + '\n')
datafile = open(test_data, 'wb')
self.write_test_file(datafile)
datafile.close()
def write_test_file(self, datafile):
arr = []
for t in self.build.get_tests():
name = t.get_name()
fname = os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))
arr.append([name, fname])
pickle.dump(arr, datafile)
def generate_dep_gen_rules(self, outfile):
outfile.write('# Rules for external dependency generators.\n\n')
processed = {}

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys, subprocess, time, datetime
import sys, subprocess, time, datetime, pickle
from optparse import OptionParser
parser = OptionParser()
@ -39,11 +39,11 @@ def run_tests(options, datafilename):
logfilename = logfile_base + '-' + options.wrapper.replace(' ', '_') + '.txt'
logfile = open(logfilename, 'w')
logfile.write('Log of Meson test suite run on %s.\n\n' % datetime.datetime.now().isoformat())
for line in open(datafilename, 'r'):
line = line.strip()
if line == '':
continue
cmd = wrap + [line]
tests = pickle.load(open(datafilename, 'rb'))
for test in tests:
name = test[0]
fname = test[1]
cmd = wrap + [fname]
starttime = time.time()
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, stde) = p.communicate()
@ -53,11 +53,11 @@ def run_tests(options, datafilename):
stde = stde.decode()
if p.returncode != 0:
result_str = 'Test "%s": FAIL (%.3f s)' % (line, duration)
result_str = 'Test "%s": FAIL (%.3f s)' % (name, duration)
else:
result_str = 'Test "%s": OK (%.3f s)' % (line, duration)
result_str = 'Test "%s": OK (%.3f s)' % (name, duration)
print(result_str)
write_log(logfile, line, result_str, stdo, stde)
write_log(logfile, name, result_str, stdo, stde)
print('\nFull log written to %s.' % logfilename)
if __name__ == '__main__':

Loading…
Cancel
Save