3 pub(super) fn test_target(target: TargetResult) {
4 // Grab the TargetResult struct. If we successfully retrieved
5 // a Target, then the test JSON encoding/decoding can run for this
6 // Target on this testing platform (i.e., checking the iOS targets
7 // only on a Mac test platform).
8 if let Ok(original) = target {
9 original.check_consistency();
10 let as_json = original.to_json();
11 let parsed = Target::from_json(as_json).unwrap();
12 assert_eq!(original, parsed);
17 fn check_consistency(&self) {
18 // Check that LLD with the given flavor is treated identically to the linker it emulates.
19 // If you target really needs to deviate from the rules below, whitelist it
20 // and document the reasons.
22 self.linker_flavor == LinkerFlavor::Msvc
23 || self.linker_flavor == LinkerFlavor::Lld(LldFlavor::Link),
24 self.options.lld_flavor == LldFlavor::Link,
27 &self.options.pre_link_args,
28 &self.options.pre_link_args_crt,
29 &self.options.late_link_args,
30 &self.options.late_link_args_dynamic,
31 &self.options.late_link_args_static,
32 &self.options.post_link_args,
35 args.get(&LinkerFlavor::Msvc),
36 args.get(&LinkerFlavor::Lld(LldFlavor::Link)),
38 if args.contains_key(&LinkerFlavor::Msvc) {
39 assert_eq!(self.options.lld_flavor, LldFlavor::Link);