@@ -17,16 +17,18 @@ Future<void> main() async {
17
17
final linkOutputBuilder = LinkOutputBuilder ();
18
18
final targetArchitecture = Architecture .current;
19
19
final targetOS = OS .current;
20
+ late final bool rustToolchainInstalled;
20
21
setUpAll (() async {
21
22
final tempUri = await tempDirForTest ();
22
23
final tempUri2 = await tempDirForTest ();
23
24
staticLib = tempUri.resolve (targetOS.staticlibFileName ('libtest' ));
24
- await Process .run ('rustc' , [
25
+ final processResult = await Process .run ('rustc' , [
25
26
'--crate-type=staticlib' ,
26
27
'test/clinker/testfiles/linker/test.rs' ,
27
28
'-o' ,
28
29
staticLib.toFilePath (),
29
30
]);
31
+ rustToolchainInstalled = processResult.exitCode == 0 ;
30
32
final linkInputBuilder = LinkInputBuilder ()
31
33
..setupShared (
32
34
packageName: 'testpackage' ,
@@ -50,6 +52,9 @@ Future<void> main() async {
50
52
).copy (tempUri.resolve ('libtest.a' ).toFilePath ());
51
53
});
52
54
test ('link rust binary with script treeshakes' , () async {
55
+ if (! rustToolchainInstalled) {
56
+ return ;
57
+ }
53
58
final treeshakeOption = LinkerOptions .treeshake (
54
59
symbolsToKeep: ['my_other_func' ],
55
60
);
@@ -69,6 +74,9 @@ Future<void> main() async {
69
74
});
70
75
71
76
test ('link rust binary without script keeps symbols' , () async {
77
+ if (! rustToolchainInstalled) {
78
+ return ;
79
+ }
72
80
final manualOption = LinkerOptions .manual (
73
81
symbolsToKeep: ['my_other_func' ],
74
82
stripDebug: true ,
@@ -110,6 +118,5 @@ Future<String?> _link(
110
118
111
119
await expectMachineArchitecture (asset.file! , targetArchitecture, targetOS);
112
120
113
- final symbols = await readSymbols (asset, targetOS);
114
- return symbols;
121
+ return await readSymbols (asset, targetOS);
115
122
}
0 commit comments