Skip to content

Commit 8dc8c4f

Browse files
committed
remove ctest-old from ctest-test
1 parent 417f1ee commit 8dc8c4f

File tree

11 files changed

+17
-2884
lines changed

11 files changed

+17
-2884
lines changed

ctest-test/Cargo.toml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ edition = "2021"
77

88
[build-dependencies]
99
ctest = { path = "../ctest" }
10-
ctest-next = { path = "../ctest-next" }
1110
cc = "1.2"
1211

1312
[dev-dependencies]
1413
ctest = { path = "../ctest" }
15-
ctest-next = { path = "../ctest-next" }
1614

1715
[dependencies]
18-
cfg-if = "1.0.1"
1916
libc = { path = ".." }
2017

2118
[[bin]]
@@ -26,22 +23,6 @@ test = false
2623
name = "t2"
2724
test = false
2825

29-
[[bin]]
30-
name = "t1_next"
31-
test = false
32-
33-
[[bin]]
34-
name = "t2_next"
35-
test = false
36-
37-
[[bin]]
38-
name = "t1_cxx"
39-
test = false
40-
41-
[[bin]]
42-
name = "t2_cxx"
43-
test = false
44-
4526
# FIXME(msrv): These should be moved to the root Cargo.toml as `[workspace.lints.*]`
4627
# once MSRV is above 1.64 and replaced with `[lints] workspace=true`
4728

ctest-test/build.rs

Lines changed: 6 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::process::Command;
2-
31
fn main() {
42
use std::env;
53
let opt_level = env::var("OPT_LEVEL")
@@ -12,88 +10,11 @@ fn main() {
1210
}
1311

1412
do_cc();
15-
test_ctest_c();
16-
test_ctest_cpp();
17-
test_ctest_next();
18-
}
19-
20-
fn test_ctest_c() {
21-
ctest::TestGenerator::new()
22-
.header("t1.h")
23-
.include("src")
24-
.fn_cname(|a, b| b.unwrap_or(a).to_string())
25-
.type_name(move |ty, is_struct, is_union| match ty {
26-
"T1Union" => ty.to_string(),
27-
"Transparent" => ty.to_string(),
28-
t if is_struct => format!("struct {t}"),
29-
t if is_union => format!("union {t}"),
30-
t => t.to_string(),
31-
})
32-
.volatile_item(t1_volatile)
33-
.array_arg(t1_arrays)
34-
.skip_roundtrip(|n| n == "Arr")
35-
.skip_const(|name| name == "T1S")
36-
.generate("src/t1.rs", "t1gen.rs");
37-
38-
ctest::TestGenerator::new()
39-
.header("t2.h")
40-
.include("src")
41-
.skip_const(|name| name == "T2S")
42-
.type_name(move |ty, is_struct, is_union| match ty {
43-
"T2Union" => ty.to_string(),
44-
t if is_struct => format!("struct {t}"),
45-
t if is_union => format!("union {t}"),
46-
t => t.to_string(),
47-
})
48-
.skip_roundtrip(|_| true)
49-
.generate("src/t2.rs", "t2gen.rs");
50-
}
51-
52-
fn test_ctest_cpp() {
53-
println!("cargo::rustc-check-cfg=cfg(has_cxx)");
54-
if !cfg!(unix) || Command::new("c++").arg("v").output().is_ok() {
55-
// A C compiler is always available, but these are only run if a C++ compiler is
56-
// also available.
57-
println!("cargo::rustc-cfg=has_cxx");
58-
59-
ctest::TestGenerator::new()
60-
.header("t1.h")
61-
.language(ctest::Lang::CXX)
62-
.include("src")
63-
.fn_cname(|a, b| b.unwrap_or(a).to_string())
64-
.type_name(move |ty, is_struct, is_union| match ty {
65-
"T1Union" => ty.to_string(),
66-
"Transparent" => ty.to_string(),
67-
t if is_struct => format!("struct {t}"),
68-
t if is_union => format!("union {t}"),
69-
t => t.to_string(),
70-
})
71-
.skip_const(|name| name == "T1S")
72-
.volatile_item(t1_volatile)
73-
.array_arg(t1_arrays)
74-
.skip_roundtrip(|n| n == "Arr")
75-
.generate("src/t1.rs", "t1gen_cxx.rs");
76-
77-
ctest::TestGenerator::new()
78-
.header("t2.h")
79-
.language(ctest::Lang::CXX)
80-
.include("src")
81-
.skip_const(|name| name == "T2S")
82-
.type_name(move |ty, is_struct, is_union| match ty {
83-
"T2Union" => ty.to_string(),
84-
t if is_struct => format!("struct {t}"),
85-
t if is_union => format!("union {t}"),
86-
t => t.to_string(),
87-
})
88-
.skip_roundtrip(|_| true)
89-
.generate("src/t2.rs", "t2gen_cxx.rs");
90-
} else {
91-
println!("cargo::warning=skipping C++ tests");
92-
}
13+
test_ctest();
9314
}
9415

95-
fn test_ctest_next() {
96-
let mut t1gen = ctest_next::TestGenerator::new();
16+
fn test_ctest() {
17+
let mut t1gen = ctest::TestGenerator::new();
9718
t1gen
9819
.header("t1.h")
9920
.include("src")
@@ -112,17 +33,17 @@ fn test_ctest_next() {
11233
// The parameter `a` of the functions `T1r`, `T1s`, `T1t`, `T1v` is an array.
11334
.array_arg(|f, p| matches!(f.ident(), "T1r" | "T1s" | "T1t" | "T1v") && p.ident() == "a")
11435
.skip_roundtrip(|n| n == "Arr");
115-
ctest_next::generate_test(&mut t1gen, "src/t1.rs", "t1nextgen.rs").unwrap();
36+
ctest::generate_test(&mut t1gen, "src/t1.rs", "t1gen.rs").unwrap();
11637

117-
let mut t2gen = ctest_next::TestGenerator::new();
38+
let mut t2gen = ctest::TestGenerator::new();
11839
t2gen
11940
.header("t2.h")
12041
.include("src")
12142
// public C typedefs have to manually be specified because they are identical to normal
12243
// structs on the Rust side.
12344
.rename_union_ty(|ty| (ty == "T2Union").then_some(ty.to_string()))
12445
.skip_roundtrip(|_| true);
125-
ctest_next::generate_test(&mut t2gen, "src/t2.rs", "t2nextgen.rs").unwrap();
46+
ctest::generate_test(&mut t2gen, "src/t2.rs", "t2gen.rs").unwrap();
12647
}
12748

12849
fn do_cc() {
@@ -140,20 +61,3 @@ fn do_cc() {
14061
println!("cargo:rerun-if-changed=src/t2.c");
14162
println!("cargo:rerun-if-changed=src/t2.h");
14263
}
143-
144-
fn t1_volatile(i: ctest::VolatileItemKind) -> bool {
145-
use ctest::VolatileItemKind::*;
146-
match i {
147-
StructField(ref n, ref f) if n == "V" && f == "v" => true,
148-
Static(ref n) if n == "vol_ptr" => true,
149-
FunctionArg(ref n, 0) if n == "T1_vol0" => true,
150-
FunctionArg(ref n, 1) if n == "T1_vol2" => true,
151-
FunctionRet(ref n) if n == "T1_vol1" || n == "T1_vol2" => true,
152-
Static(ref n) if n == "T1_fn_ptr_vol" => true,
153-
_ => false,
154-
}
155-
}
156-
157-
fn t1_arrays(n: &str, i: usize) -> bool {
158-
i == 0 && matches!(n, "T1r" | "T1s" | "T1t" | "T1v")
159-
}

ctest-test/src/bin/t1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#![cfg(not(test))]
22
#![deny(warnings)]
33

4-
use std::ffi::c_uint;
5-
64
use ctest_test::t1::*;
75

86
include!(concat!(env!("OUT_DIR"), "/t1gen.rs"));

ctest-test/src/bin/t1_cxx.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

ctest-test/src/bin/t1_next.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

ctest-test/src/bin/t2_cxx.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

ctest-test/src/bin/t2_next.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)