Skip to content

Commit add42a6

Browse files
mbyxtgross35
authored andcommitted
libc: remove ctest_old and src-hotfix directory.
(backport <#4681>) (cherry picked from commit 78196ba)
1 parent afee395 commit add42a6

File tree

3 files changed

+4
-264
lines changed

3 files changed

+4
-264
lines changed

Cargo.lock

Lines changed: 4 additions & 222 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libc-test/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }
2020

2121
[build-dependencies]
2222
cc = "1.2.29"
23-
ctest-old = { version = "0.4.11", package = "ctest" }
2423
# Use the in-tree `ctest` from the `main` branch via crates.io
2524
ctest = "0.5.0-beta.0"
2625
regex = "1.11.1"

libc-test/build.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ use std::io::{BufRead, BufReader, BufWriter, Write};
66
use std::path::{Path, PathBuf};
77
use std::{env, io};
88

9-
fn src_hotfix_dir() -> PathBuf {
10-
Path::new(&env::var_os("OUT_DIR").unwrap()).join("src-hotfix")
11-
}
12-
139
fn do_cc() {
1410
let target = env::var("TARGET").unwrap();
1511
if cfg!(unix) || target.contains("cygwin") {
@@ -73,15 +69,6 @@ fn do_ctest() {
7369
}
7470
}
7571

76-
#[expect(unused)]
77-
fn ctest_old_cfg() -> ctest_old::TestGenerator {
78-
let mut cfg = ctest_old::TestGenerator::new();
79-
let libc_cfgs = ["libc_thread_local"];
80-
for f in &libc_cfgs {
81-
cfg.cfg(f, None);
82-
}
83-
cfg
84-
}
8572
fn ctest_cfg() -> ctest::TestGenerator {
8673
let mut cfg = ctest::TestGenerator::new();
8774
cfg.skip_private(true);
@@ -170,39 +157,11 @@ fn main() {
170157
// Avoid unnecessary re-building.
171158
println!("cargo:rerun-if-changed=build.rs");
172159

173-
let hotfix_dir = src_hotfix_dir();
174-
if std::fs::exists(&hotfix_dir).unwrap() {
175-
std::fs::remove_dir_all(&hotfix_dir).unwrap();
176-
}
177-
178-
// FIXME(ctest): ctest2 cannot parse `crate::` in paths, so replace them with `::`
179-
let re = regex::bytes::Regex::new(r"(?-u:\b)crate::").unwrap();
180-
copy_dir_hotfix(Path::new("../src"), &hotfix_dir, &re, b"::");
181-
182160
do_cc();
183161
do_ctest();
184162
do_semver();
185163
}
186164

187-
// FIXME(clippy): removing `replace` somehow fails the `Test tier1 (x86_64-pc-windows-msvc, windows-2022)` CI job
188-
#[allow(clippy::only_used_in_recursion)]
189-
fn copy_dir_hotfix(src: &Path, dst: &Path, regex: &regex::bytes::Regex, replace: &[u8]) {
190-
std::fs::create_dir(dst).unwrap();
191-
for entry in src.read_dir().unwrap() {
192-
let entry = entry.unwrap();
193-
let src_path = entry.path();
194-
let dst_path = dst.join(entry.file_name());
195-
if entry.file_type().unwrap().is_dir() {
196-
copy_dir_hotfix(&src_path, &dst_path, regex, replace);
197-
} else {
198-
// Replace "crate::" with "::"
199-
let src_data = std::fs::read(&src_path).unwrap();
200-
let dst_data = regex.replace_all(&src_data, b"::");
201-
std::fs::write(&dst_path, &dst_data).unwrap();
202-
}
203-
}
204-
}
205-
206165
macro_rules! headers {
207166
($cfg:ident: [$m:expr]: $header:literal) => {
208167
if $m {

0 commit comments

Comments
 (0)