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.add_item('DESC', 'Running test suite under Valgrind.')
velem.write(outfile) velem.write(outfile)
datafile = open(test_data, 'w') datafile = open(test_data, 'wb')
for t in self.build.get_tests(): self.write_test_file(datafile)
datafile.write(os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe())) + '\n')
datafile.close() 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): def generate_dep_gen_rules(self, outfile):
outfile.write('# Rules for external dependency generators.\n\n') outfile.write('# Rules for external dependency generators.\n\n')
processed = {} processed = {}

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

Loading…
Cancel
Save