From 237179e1541d9cf81632e11a4fcade0b9cc71dbb Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Thu, 27 Jan 2011 21:12:58 +0000 Subject: [PATCH] Support use of Now we always run 0test (instead of trying to work out whether there are any tests to be run). This means we no longer skip tests where the new syntax is used. --- 0release.xml | 4 ++++ release.py | 15 ++++++++------- tests/testrelease.py | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/0release.xml b/0release.xml index 3577d92..0cf51a3 100644 --- a/0release.xml +++ b/0release.xml @@ -26,6 +26,10 @@ + + + + diff --git a/release.py b/release.py index 14bb256..bb87017 100644 --- a/release.py +++ b/release.py @@ -15,13 +15,14 @@ valid_phases = ['commit-release', 'generate-archive'] TMP_BRANCH_NAME = '0release-tmp' -def run_unit_tests(local_feed, impl): - self_test = impl.metadata.get('self-test', None) - if self_test is None: - print "SKIPPING unit tests for %s (no 'self-test' attribute set)" % impl +test_command = os.environ['0TEST'] + +def run_unit_tests(local_feed): + print "Running self-tests..." + exitstatus = subprocess.call([test_command, '--', local_feed]) + if exitstatus == 2: + print "SKIPPED unit tests for %s (no 'self-test' attribute set)" % local_feed return - print "Running self-test:", self_test - exitstatus = subprocess.call(['0launch', 'http://0install.net/2008/interfaces/0test.xml', local_feed]) if exitstatus: raise SafeException("Self-test failed with exit status %d" % exitstatus) @@ -466,7 +467,7 @@ def do_release(local_iface, options): if status.src_tests_passed: print "Unit-tests already passed - not running again" else: - run_unit_tests(extracted_iface_path, extracted_impl) + run_unit_tests(extracted_iface_path) status.src_tests_passed = True status.save() except SafeException: diff --git a/tests/testrelease.py b/tests/testrelease.py index 646518e..ebb6b9e 100755 --- a/tests/testrelease.py +++ b/tests/testrelease.py @@ -17,6 +17,7 @@ test_repo_c = mydir + '/c-prog.tgz' test_gpg = mydir + '/gpg.tgz' def call_with_output_suppressed(cmd, stdin, expect_failure = False, **kwargs): + #cmd = [cmd[0], '-v'] + cmd[1:] if stdin: child = subprocess.Popen(cmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE, **kwargs) else: @@ -24,8 +25,8 @@ def call_with_output_suppressed(cmd, stdin, expect_failure = False, **kwargs): stdout, stderr = child.communicate(stdin) if (child.returncode != 0) == expect_failure: return stdout, stderr - print stdout - raise Exception("Return code %d" % child.returncode) + #print stdout, stderr + raise Exception("Return code %d from %s\nstdout: %s\nstderr: %s" % (child.returncode, cmd, stdout, stderr)) def make_releases_dir(src_feed = '../hello/HelloWorld.xml', auto_upload = False): os.chdir('releases') -- 2.11.4.GIT