Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c3c6198

Browse files
committed
Add test to self-check Config::has_atomic()
1 parent 0a0db62 commit c3c6198

File tree

1 file changed

+25
-0
lines changed
  • src/tools/compiletest/src/header

1 file changed

+25
-0
lines changed

‎src/tools/compiletest/src/header/tests.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,31 @@ fn threads_support() {
718718
}
719719
}
720720

721+
#[test]
722+
fn target_has_atomic_support() {
723+
let atomics = [
724+
("aarch64-unknown-linux-gnu", &["8", "16", "32", "64", "128", "ptr"][..], &[][..]),
725+
("aarch64-apple-darwin", &["8", "16", "32", "64", "128", "ptr"], &[]),
726+
("i686-pc-windows-gnu", &["8", "16", "32", "64", "ptr"], &["128"]),
727+
("i686-pc-windows-msvc", &["8", "16", "32", "64", "ptr"], &["128"]),
728+
("i686-unknown-linux-gnu", &["8", "16", "32", "64", "ptr"], &["128"]),
729+
("x86_64-apple-darwin", &["8", "16", "32", "64", "128", "ptr"], &[]),
730+
("x86_64-pc-windows-gnu", &["8", "16", "32", "64", "128", "ptr"], &[]),
731+
("x86_64-pc-windows-msvc", &["8", "16", "32", "64", "128", "ptr"], &[]),
732+
("x86_64-unknown-linux-gnu", &["8", "16", "32", "64", "ptr"], &["128"]),
733+
];
734+
735+
for (target, supported, not_supported) in atomics {
736+
let config = cfg().target(target).build();
737+
for size in supported {
738+
assert!(config.has_atomic(size));
739+
}
740+
for size in not_supported {
741+
assert!(!config.has_atomic(size));
742+
}
743+
}
744+
}
745+
721746
fn run_path(poisoned: &mut bool, path: &Path, buf: &[u8]) {
722747
let rdr = std::io::Cursor::new(&buf);
723748
iter_header(Mode::Ui, "ui", poisoned, path, rdr, &mut |_| {});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /