Merge lp:~larry-e-works/uci-engine/write-exitcode-to-file into lp:uci-engine

Proposed by Larry E Works
Status: Needs review
Proposed branch: lp:~larry-e-works/uci-engine/write-exitcode-to-file
Merge into: lp:uci-engine
Diff against target: 32 lines (+15/-0)
1 file modified
test_runner/tstrun/run_test.py (+15/-0)
To merge this branch: bzr merge lp:~larry-e-works/uci-engine/write-exitcode-to-file
Reviewer Review Type Date Requested Status
Vincent Ladeuil (community) Approve
Evan (community) Needs Fixing
Paul Larson Approve
Francis Ginther Approve
Review via email: mp+246721@code.launchpad.net

Commit message

Write adt-run exitcode into a file in the results directory.

Description of the change

Added bits to write the exit code to the results. Relevant trello task is: https://trello.com/c/sN5Awtbr/101-0-5-testrunner-to-create-a-file-with-the-exitcode-to-be-part-of-test-results

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

A couple of small comments

review: Needs Fixing
Revision history for this message
Francis Ginther (fginther) wrote :

As Paul mentioned, instead of using the explicit open/close as in:

    exitcode = open(ec_path, 'w')
    exitcode.write(ec)
    exitcode.close()

You can use the context manager style to write:

    with open(ec_path, 'w') as exitcode:
        exitcode.write(ec)

I don't know if there is a preferred name for the exit_code file. The one chosen looks good to me.

Revision history for this message
Francis Ginther (fginther) wrote :

looks good.

review: Approve
Revision history for this message
Paul Larson (pwlars) wrote :

+1

review: Approve
Revision history for this message
Evan (ev) :
review: Needs Fixing
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Hmm, some administrativia to follow

review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (124.1 KiB)

The attempt to merge lp:~larry-e-works/uci-engine/write-exitcode-to-file into lp:uci-engine failed. Below is the output from the failed tests.

Checking juju status
Private PPAs: disabled
Preparing local branch upload...
Uploading local branch, fingerprint 30005b74130e4bea60cbc29b15908ded57f599d3
Installing keys from bzr+ssh://bazaar.launchpad.net/~ci-engineering-private/+junk/ci-airline-dev-keys/
Running juju-deployer -v -c /tmp/tmpt0kA7i/deployer/relations.yaml -c /tmp/tmpt0kA7i/deployer/services.yaml ci-airline
Checking juju status
Private PPAs: disabled
Preparing local branch upload...
Reusing local branch, fingerprint 30005b74130e4bea60cbc29b15908ded57f599d3
Installing keys from bzr+ssh://bazaar.launchpad.net/~ci-engineering-private/+junk/ci-airline-dev-keys/
Running juju-deployer -v -c /tmp/tmpcHUCUF/deployer/relations.yaml -c /tmp/tmpcHUCUF/deployer/services.yaml ci-ubuntucore
Tests running...
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testConnectFailed ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testProcessQueue ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testRunForever ... OK (0.102 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testSent ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp.TestProgressTrigger.testProgress ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testCancel ... OK (0.105 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoQueue ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoTicket ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageCalledProcessError ... OK (0.005 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageDataStoreException ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageFail ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageKilled ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageSimple ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageUnexpected ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testSaveLastRun ... OK (0.015 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCBRuns ... OK (0.021 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCanCancel ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_invalid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_valid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_abspath ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_basename ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_relpath ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_empty_single_config ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_multiple_config ... OK (0.008 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_single_con...

Unmerged revisions

924. By Larry E Works

Added bits to ensure results directory exists per Evan's comment to previous MP. Used os.makedirs instead of os.mkdir as it will ensure all intermediate-level directories are created. While this is not currently needed it may be when the test runner is modified to copy all results to swift.

923. By Larry E Works

Incorporated Pauls recommendation to user context manager instead of the explicit open/close.

922. By Larry E Works

Added the bit to put the exit code in the results directory.

921. By Larry E Works

Added bits to write the test exitcode to a file.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test_runner/tstrun/run_test.py'
2--- test_runner/tstrun/run_test.py 2014-10-17 12:28:14 +0000
3+++ test_runner/tstrun/run_test.py 2015-01-20 20:20:33 +0000
4@@ -22,6 +22,16 @@
5 import unittest
6
7
8+def mk_results_dir(results_dir):
9+ try:
10+ os.makedirs(results_dir)
11+ except OSError as exc:
12+ if exc.errno == errno.EEXISTS and os.path.isdir(results_dir):
13+ pass
14+ else:
15+ raise
16+
17+
18 def run(*args, **kwargs):
19 """Run a command in a subprocess.
20
21@@ -188,6 +198,11 @@
22 '-H', ip, '-l', login, '-i', ssh_key_path])
23 proc, _, _ = run(*cmd, check_rc=False)
24 rc = proc.returncode
25+ ec = str(rc)
26+ mk_results_dir('results')
27+ ec_path = os.path.join('results', 'exit_code')
28+ with open(ec_path, 'w') as exitcode:
29+ exitcode.write(ec)
30 pkg_version = package_version('results')
31 deps_versions = aggregate_versions('results')
32 for name, status in parse_summary(summary_path):

Subscribers

People subscribed via source and target branches