Skip to content

[0.2] Backports #4595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bad06bb
Adding strftime* for illumos/solaris.
devnexen May 11, 2025
9bc1269
Enable the `rust_2024_compatibility` lint
tgross35 Jul 26, 2025
4ab6184
add prctl constants on android
dead10ck Jun 29, 2025
92b7c1b
l4re: Move `pthread_attr_t` into `s!`
tgross35 Jul 28, 2025
91179ca
Update the `c_enum` macro to take multiple values
tgross35 Aug 11, 2025
2f5ae6c
haiku: Switch from `e!` to `c_enum!`
tgross35 Aug 11, 2025
e2396b1
psp: Correct char -> c_char
tgross35 Aug 11, 2025
c409f7d
Don't allow `improper_ctypes`
tgross35 Jul 26, 2025
3b8b9ac
Add 'struct ld_info' and friends.
Jul 24, 2025
fe5a394
Remove duplicate constant definitions FIND and ENTER.
Jul 28, 2025
181138a
netbsd/openbsd: Export ioctl request generator macros
qinghon May 24, 2025
3a7e489
Fix the types of 'struct stat'/'stat stat64' fields 'st_*tim'.
xingxue-ibm Jul 29, 2025
44169ad
NetBSD: mark an enum `#[repr(C)]`
tgross35 Jul 29, 2025
9f11c85
NetBSD: add ptsname_r support
0-wiz-0 Aug 1, 2025
f6d06e4
Export UDP socket option consts on Android
hulthe Aug 6, 2025
46acaae
riscv32: Define plain syscalls as their time64 variants
kraj Aug 2, 2025
b3b9be4
Enable statx on musl-libc
neuschaefer Oct 16, 2024
4e8bc3b
Haiku: move BSD API to a separate file
nielx Dec 23, 2024
2d19d49
Haiku: add additional functionality in libbsd.so
nielx Dec 25, 2024
20476f2
freebsd: Fix type of struct xktls_session_onedir, field ifnet
neuschaefer Jul 16, 2025
9f3d6cf
freebsd: Document avoidance of reserved name `gen`
neuschaefer Jul 24, 2025
57adc47
libc-test: Account for xktls_session_onedir::gen (freebsd)
neuschaefer Jul 24, 2025
2a1f8fb
libc-test: include sys/ktls.h on freebsd
neuschaefer Jul 16, 2025
0b2b433
freebsd15: Add ki_uerrmsg to struct kinfo_proc
neuschaefer Jul 16, 2025
1b01afd
freebsd adding further TCP stack related constants.
devnexen Dec 16, 2024
7a56b98
Rename the ctest file from `main` to `ctest`
tgross35 Aug 10, 2025
57fc44a
cleanup: Format a file that was missed
tgross35 Aug 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/create-artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@


def main():
# Find the most recently touched file named "main.c" in the target
# Find the most recently touched file named "ctest_output.c" in the target
# directory. This will be libc-tests's `OUT_DIR`
marker_files = [Path(p) for p in glob("target/**/main.c", recursive=True)]
marker_files = [Path(p) for p in glob("target/**/ctest_output.c", recursive=True)]
marker_files.sort(key=lambda path: path.stat().st_mtime)
build_dir = marker_files[0].parent
print(f"Located build directory '{build_dir}'")
Expand Down
100 changes: 58 additions & 42 deletions ci/ios/deploy_and_run_on_ios_simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,35 @@
// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy
// test.

use std::env;
use std::fs::{self, File};
use std::io::Write;
use std::path::Path;
use std::process;
use std::process::Command;
use std::{env, process};

macro_rules! t {
($e:expr) => (match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with: {e}", stringify!($e)),
})
($e:expr) => {
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with: {e}", stringify!($e)),
}
};
}

// Step one: Wrap as an app
fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
println!("Packaging simulator app");
drop(fs::remove_dir_all("ios_simulator_app"));
t!(fs::create_dir("ios_simulator_app"));
t!(fs::copy(test_binary_path,
Path::new("ios_simulator_app").join(crate_name)));
t!(fs::copy(
test_binary_path,
Path::new("ios_simulator_app").join(crate_name)
));

let mut f = t!(File::create("ios_simulator_app/Info.plist"));
t!(f.write_all(format!(r#"
t!(f.write_all(
format!(
r#"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC
"-//Apple//DTD PLIST 1.0//EN"
Expand All @@ -42,7 +47,11 @@ fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
<string>com.rust.unittests</string>
</dict>
</plist>
"#, crate_name).as_bytes()));
"#,
crate_name
)
.as_bytes()
));
}

// Step two: Start the iOS simulator
Expand All @@ -57,8 +66,10 @@ fn start_simulator() {
for line in stdout.lines() {
if line.contains("rust_ios") {
if found_rust_sim {
panic!("Duplicate rust_ios simulators found. Please \
double-check xcrun simctl list.");
panic!(
"Duplicate rust_ios simulators found. Please \
double-check xcrun simctl list."
);
}
simulator_exists = true;
simulator_booted = line.contains("(Booted)");
Expand All @@ -69,62 +80,67 @@ fn start_simulator() {
if simulator_exists == false {
println!("Creating iOS simulator");
Command::new("xcrun")
.arg("simctl")
.arg("create")
.arg("rust_ios")
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
.check_status();
.arg("simctl")
.arg("create")
.arg("rust_ios")
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
.check_status();
} else if simulator_booted == true {
println!("Shutting down already-booted simulator");
Command::new("xcrun")
.arg("simctl")
.arg("shutdown")
.arg("rust_ios")
.check_status();
.arg("simctl")
.arg("shutdown")
.arg("rust_ios")
.check_status();
}

println!("Starting iOS simulator");
// We can't uninstall the app (if present) as that will hang if the
// simulator isn't completely booted; just erase the simulator instead.
Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
Command::new("xcrun")
.arg("simctl")
.arg("erase")
.arg("rust_ios")
.check_status();
Command::new("xcrun")
.arg("simctl")
.arg("boot")
.arg("rust_ios")
.check_status();
}

// Step three: Install the app
fn install_app_to_simulator() {
println!("Installing app to simulator");
Command::new("xcrun")
.arg("simctl")
.arg("install")
.arg("booted")
.arg("ios_simulator_app/")
.check_status();
.arg("simctl")
.arg("install")
.arg("booted")
.arg("ios_simulator_app/")
.check_status();
}

// Step four: Run the app
fn run_app_on_simulator() {
println!("Running app");
let output = t!(Command::new("xcrun")
.arg("simctl")
.arg("launch")
.arg("--console")
.arg("booted")
.arg("com.rust.unittests")
.output());
.arg("simctl")
.arg("launch")
.arg("--console")
.arg("booted")
.arg("com.rust.unittests")
.output());

println!("status: {}", output.status);
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));

let stdout = String::from_utf8_lossy(&output.stdout);
let passed = stdout.lines()
.find(|l|
(l.contains("PASSED") &&
l.contains("tests")) ||
l.contains("test result: ok")
)
.unwrap_or(false);
let passed = stdout
.lines()
.find(|l| (l.contains("PASSED") && l.contains("tests")) || l.contains("test result: ok"))
.unwrap_or(false);

println!("Shutting down simulator");
Command::new("xcrun")
Expand Down
2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rustfmt -V

# Save a list of all source files
tmpfile="file-list~" # trailing tilde for gitignore
find src -name '*.rs' > "$tmpfile"
find src ci -name '*.rs' > "$tmpfile"

# Before formatting, replace all macro identifiers with a function signature.
# This allows `rustfmt` to format it.
Expand Down
4 changes: 2 additions & 2 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ align = ["libc/align"]
extra_traits = ["libc/extra_traits"]

[[test]]
name = "main"
path = "test/main.rs"
name = "ctest"
path = "test/ctest.rs"
harness = false

[[test]]
Expand Down
Loading
Loading