From ad3bab1fc49084c304a4ef38f10a99180c15cf87 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 23 Jun 2018 15:51:22 -0700 Subject: [PATCH] Fix random errors in test compiler_json_error_format. --- tests/testsuite/build.rs | 53 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 8b86e5ce3..3c02873d8 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -3996,13 +3996,32 @@ fn compiler_json_error_format() { .file("bar/src/lib.rs", r#"fn dead() {}"#) .build(); + // Using jobs=1 to ensure that the order of messages is consistent. assert_that( - p.cargo("build") - .arg("-v") - .arg("--message-format") - .arg("json"), + p.cargo("build -v --message-format=json --jobs=1"), execs().with_status(0).with_json( r#" + { + "reason":"compiler-artifact", + "package_id":"foo 0.5.0 ([..])", + "target":{ + "kind":["custom-build"], + "crate_types":["bin"], + "name":"build-script-build", + "src_path":"[..]build.rs" + }, + "profile": { + "debug_assertions": true, + "debuginfo": 2, + "opt_level": "0", + "overflow_checks": true, + "test": false + }, + "features": [], + "filenames": "{...}", + "fresh": false + } + { "reason":"compiler-message", "package_id":"bar 0.5.0 ([..])", @@ -4036,27 +4055,6 @@ fn compiler_json_error_format() { "fresh": false } - { - "reason":"compiler-artifact", - "package_id":"foo 0.5.0 ([..])", - "target":{ - "kind":["custom-build"], - "crate_types":["bin"], - "name":"build-script-build", - "src_path":"[..]build.rs" - }, - "profile": { - "debug_assertions": true, - "debuginfo": 2, - "opt_level": "0", - "overflow_checks": true, - "test": false - }, - "features": [], - "filenames": "{...}", - "fresh": false - } - { "reason":"build-script-executed", "package_id":"foo 0.5.0 ([..])", @@ -4105,10 +4103,7 @@ fn compiler_json_error_format() { // With fresh build, we should repeat the artifacts, // but omit compiler warnings. assert_that( - p.cargo("build") - .arg("-v") - .arg("--message-format") - .arg("json"), + p.cargo("build -v --message-format=json --jobs=1"), execs().with_status(0).with_json( r#" {