Mir

Merge lp:~vanvugt/mir/test-without-entropy-more into lp:mir

Proposed by Daniel van Vugt on 2016-02-29
Status: Merged
Approved by: Daniel van Vugt on 2016-03-15
Approved revision: 3352
Merged at revision: 3394
Proposed branch: lp:~vanvugt/mir/test-without-entropy-more
Merge into: lp:mir
Diff against target: 60 lines (+33/-6)
1 file modified
tests/unit-tests/test_mir_cookie.cpp (+33/-6)
To merge this branch: bzr merge lp:~vanvugt/mir/test-without-entropy-more
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2016-03-15
Cemil Azizoglu (community) 2016-03-01 Approve on 2016-03-14
Alan Griffiths 2016-02-29 Abstain on 2016-03-07
Review via email: mp+287444@code.launchpad.net

Commit message

Add another regression test for LP: #1536662 and LP: #1541188.
This one ensures we haven't simply moved the hangs/crashes to some
later point in the Mir server's lifetime.

To post a comment you must log in.
Alan Griffiths (alan-griffiths) wrote :

+ // Disabled: While it passes in isolation, it will cause later tests to
+ // fail unless the aforementioned bugs are fixed.

Unacceptable. Test failures should indicate the reason for failure, require a hunt for an unrelated test that causes it. Doubly so for unit tests.

review: Needs Fixing
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3347
https://mir-jenkins.ubuntu.com/job/mir-ci/431/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/241
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/265
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/257
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/257
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/248
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/248/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/248
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/248/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/248
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/248/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/248
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/248/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/248
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/248/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/431/rebuild

review: Approve (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

Jenkins scripting error?

/tmp/hudson6713240626755504920.sh: line 100: syntax error near unexpected token `fi'

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3351
https://mir-jenkins.ubuntu.com/job/mir-ci/455/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/274/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/298
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/290
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/290
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/282
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/282/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/282/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/282
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/282/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/282/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/282
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/282/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/455/rebuild

review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

The failures are technically unrelated to these changes, although the first one has a fix coming very soon:
  * bug 1541188
  * bug 1552065

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3352
https://mir-jenkins.ubuntu.com/job/mir-ci/465/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/289
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/314
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/297/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/465/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

OK, but maybe the test should now be enabled?

review: Abstain
Daniel van Vugt (vanvugt) wrote :

Nope. The test now fails reliably.

To see it passing you need:
https://code.launchpad.net/~vanvugt/mir/run-without-entropy/+merge/287445

Cemil Azizoglu (cemil-azizoglu) wrote :

Ok

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/97/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/469/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/105/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/499
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/491
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/491
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/478
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/478/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/478/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/478
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/478/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/478
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/478/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/478
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/478/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

Looks like bug 1523621. Unrelated.

Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/unit-tests/test_mir_cookie.cpp'
2--- tests/unit-tests/test_mir_cookie.cpp 2016-02-26 03:37:46 +0000
3+++ tests/unit-tests/test_mir_cookie.cpp 2016-03-02 03:35:47 +0000
4@@ -25,6 +25,21 @@
5 #include <chrono>
6 #include <fcntl.h>
7
8+namespace {
9+
10+void drain_dev_random()
11+{
12+ // Flush the entropy pool
13+ int fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
14+ ASSERT_THAT(fd, ::testing::Ge(0));
15+ char buf[256];
16+ while (read(fd, buf, sizeof buf) > 0) {}
17+ close(fd);
18+}
19+
20+} // anonymous namespace
21+
22+
23 TEST(MirCookieAuthority, attests_real_timestamp)
24 {
25 std::vector<uint8_t> secret{ 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xde, 0x01 };
26@@ -123,12 +138,7 @@
27 { // Regression test for LP: #1536662 and LP: #1541188
28 using namespace testing;
29
30- // Flush the entropy pool
31- int fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
32- ASSERT_THAT(fd, Ge(0));
33- char buf[256];
34- while (read(fd, buf, sizeof buf) > 0) {}
35- close(fd);
36+ drain_dev_random();
37
38 auto start = std::chrono::high_resolution_clock::now();
39
40@@ -138,3 +148,20 @@
41 int seconds = std::chrono::duration_cast<std::chrono::seconds>(duration).count();
42 EXPECT_THAT(seconds, Lt(15));
43 }
44+
45+TEST(MirCookieAuthority, DISABLED_makes_cookies_quickly)
46+{ // Regression test for LP: #1536662 and LP: #1541188
47+ using namespace testing;
48+
49+ drain_dev_random();
50+ uint64_t timestamp = 23;
51+ std::vector<uint8_t> secret;
52+ auto source_authority = mir::cookie::Authority::create_saving(secret);
53+
54+ drain_dev_random();
55+ auto start = std::chrono::high_resolution_clock::now();
56+ auto cookie = source_authority->make_cookie(timestamp);
57+ auto duration = std::chrono::high_resolution_clock::now() - start;
58+ int seconds = std::chrono::duration_cast<std::chrono::seconds>(duration).count();
59+ EXPECT_THAT(seconds, Lt(5));
60+}

Subscribers

People subscribed via source and target branches