@@ -1361,7 +1361,6 @@ fn doc_workspace_open_first_one_built_for_host() {
1361
1361
. file ( "bar/src/lib.rs" , "" )
1362
1362
. build ( ) ;
1363
1363
1364
- // The order in which bar is compiled or documented is not deterministic
1365
1364
p. cargo ( "doc --workspace --open" )
1366
1365
. masquerade_as_nightly_cargo ( & [ "per-package-target" ] )
1367
1366
. env ( "BROWSER" , tools:: echo ( ) )
@@ -1413,7 +1412,6 @@ fn doc_workspace_open_first_one_when_no_one_built_for_host() {
1413
1412
. file ( "bar/src/lib.rs" , "" )
1414
1413
. build ( ) ;
1415
1414
1416
- // The order in which bar is compiled or documented is not deterministic
1417
1415
p. cargo ( "doc --workspace --open" )
1418
1416
. masquerade_as_nightly_cargo ( & [ "per-package-target" ] )
1419
1417
. env ( "BROWSER" , tools:: echo ( ) )
@@ -1426,6 +1424,106 @@ fn doc_workspace_open_first_one_when_no_one_built_for_host() {
1426
1424
. run ( ) ;
1427
1425
}
1428
1426
1427
+ #[ cargo_test( nightly, reason = "-Zper-package-target is unstable" ) ]
1428
+ fn doc_workspace_open_first_one_built_for_target ( ) {
1429
+ const TARGET : & str = "i686-unknown-linux-gnu" ;
1430
+
1431
+ let p = project ( )
1432
+ . file (
1433
+ "Cargo.toml" ,
1434
+ r#"
1435
+ [workspace]
1436
+ members = ["foo", "bar"]
1437
+ "# ,
1438
+ )
1439
+ . file ( "foo/Cargo.toml" , & basic_manifest ( "foo" , "0.1.0" ) )
1440
+ . file ( "foo/src/lib.rs" , "" )
1441
+ . file (
1442
+ "bar/Cargo.toml" ,
1443
+ & format ! (
1444
+ r#"
1445
+ cargo-features = ["per-package-target"]
1446
+ [package]
1447
+ name = "bar"
1448
+ version = "0.1.0"
1449
+ forced-target = "{}"
1450
+ "# ,
1451
+ TARGET
1452
+ ) ,
1453
+ )
1454
+ . file ( "bar/src/lib.rs" , "" )
1455
+ . build ( ) ;
1456
+
1457
+ p. cargo ( "doc --workspace --open --target" )
1458
+ . arg ( TARGET )
1459
+ . masquerade_as_nightly_cargo ( & [ "per-package-target" ] )
1460
+ . env ( "BROWSER" , tools:: echo ( ) )
1461
+ . with_stderr_contains ( "[..] Documenting bar v0.1.0 ([..])" )
1462
+ . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1463
+ . with_stderr_contains ( & format ! (
1464
+ "[..] Opening [..]/target/{}/doc/bar/index.html" ,
1465
+ TARGET
1466
+ ) )
1467
+ . run ( ) ;
1468
+ }
1469
+
1470
+ #[ cargo_test( nightly, reason = "-Zper-package-target is unstable" ) ]
1471
+ fn doc_workspace_open_first_one_when_no_one_built_for_target ( ) {
1472
+ const TARGET : & str = "i686-unknown-linux-gnu" ;
1473
+
1474
+ let p = project ( )
1475
+ . file (
1476
+ "Cargo.toml" ,
1477
+ r#"
1478
+ [workspace]
1479
+ members = ["foo", "bar"]
1480
+ "# ,
1481
+ )
1482
+ . file (
1483
+ "foo/Cargo.toml" ,
1484
+ & format ! (
1485
+ r#"
1486
+ cargo-features = ["per-package-target"]
1487
+ [package]
1488
+ name = "foo"
1489
+ version = "0.1.0"
1490
+ forced-target = "{}"
1491
+ "# ,
1492
+ TARGET
1493
+ ) ,
1494
+ )
1495
+ . file ( "foo/src/lib.rs" , "" )
1496
+ . file (
1497
+ "bar/Cargo.toml" ,
1498
+ & format ! (
1499
+ r#"
1500
+ cargo-features = ["per-package-target"]
1501
+ [package]
1502
+ name = "bar"
1503
+ version = "0.1.0"
1504
+ forced-target = "{}"
1505
+ "# ,
1506
+ TARGET
1507
+ ) ,
1508
+ )
1509
+ . file ( "bar/src/lib.rs" , "" )
1510
+ . build ( ) ;
1511
+
1512
+ // We don't build for host, so we should open the first one built for TARGET.
1513
+ let host_target = rustc_host ( ) ;
1514
+ p. cargo ( "doc --workspace --open --target" )
1515
+ . arg ( host_target)
1516
+ . masquerade_as_nightly_cargo ( & [ "per-package-target" ] )
1517
+ . env ( "BROWSER" , tools:: echo ( ) )
1518
+ . with_stderr_contains ( "[..] Documenting bar v0.1.0 ([..])" )
1519
+ . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1520
+ . with_stderr_contains ( & format ! (
1521
+ "[..] Opening [..]/target/{}/doc/bar/index.html" ,
1522
+ TARGET
1523
+ ) )
1524
+ . run ( ) ;
1525
+ }
1526
+
1429
1527
#[ cargo_test( nightly, reason = "-Zextern-html-root-url is unstable" ) ]
1430
1528
fn doc_extern_map_local ( ) {
1431
1529
let p = project ( )
0 commit comments