Skip to content

Commit 304ea79

Browse files
committed
Replace references to ctest2 with ctest
Since `ctest` is now in-repo, mentions of `ctest2` are updated. We can also use the local `ctest` for `libc-test`'s dependency, which helps get some test coverage.
1 parent fa3e117 commit 304ea79

File tree

9 files changed

+53
-62
lines changed

9 files changed

+53
-62
lines changed

ctest/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,3 @@ rust-version = "1.63.0"
1717
garando_syntax = "0.1"
1818
cc = "1.0.1"
1919
rustc_version = "0.4"
20-
21-
[workspace]
22-
members = ["testcrate"]

ctest/README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# ctest2
1+
# ctest
22

33
[Documentation][dox]
44

5-
[dox]: https://docs.rs/ctest2
6-
7-
**Note: This is a fork of [`ctest`], intended as a temporary replacement until maintenance of [`ctest`] resumes.**
8-
9-
[`ctest`]: https://crates.io/crates/ctest
5+
[dox]: https://docs.rs/ctest
106

117
Automated testing of FFI bindings in Rust. This repository is intended to
128
validate the `*-sys` crates that can be found on crates.io to ensure that the
@@ -38,14 +34,14 @@ mylib-sys = { path = "../mylib-sys" }
3834
libc = "0.2"
3935

4036
[build-dependencies]
41-
ctest2 = "0.4"
37+
ctest = "0.4"
4238
```
4339

4440
Next, add a build script to `systest/build.rs`:
4541

4642
```rust
4743
fn main() {
48-
let mut cfg = ctest2::TestGenerator::new();
44+
let mut cfg = ctest::TestGenerator::new();
4945

5046
// Include the header files where the C APIs are defined
5147
cfg.header("foo.h")
@@ -89,7 +85,7 @@ and returns information about the C side of things (which is validated in Rust).
8985
A large amount of configuration can be applied to how the C file is generated,
9086
you can browse [the documentation][dox].
9187

92-
## Projects using ctest2
88+
## Projects using ctest
9389

9490
- [libc](https://github.com/rust-lang/libc)
9591
- [libz-sys](https://github.com/rust-lang/libz-sys)
@@ -108,5 +104,5 @@ at your option.
108104
## Contribution
109105

110106
Unless you explicitly state otherwise, any contribution intentionally submitted
111-
for inclusion in ctest2 by you, as defined in the Apache-2.0 license, shall be
107+
for inclusion in ctest by you, as defined in the Apache-2.0 license, shall be
112108
dual licensed as above, without any additional terms or conditions.

ctest/ci/run-docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -ex
55

66
run() {
77
echo "Building docker container for TARGET=${1}"
8-
docker build -t ctest2 -f ci/docker/$1/Dockerfile ci/
8+
docker build -t ctest -f ci/docker/$1/Dockerfile ci/
99
mkdir -p target
1010
target=$1
1111
echo "Running docker"
@@ -21,7 +21,7 @@ run() {
2121
--volume `pwd`/target:/checkout/target \
2222
--workdir /checkout \
2323
--privileged \
24-
ctest2 \
24+
ctest \
2525
bash \
2626
-c 'PATH=/rust/bin:$PATH exec ci/run.sh'
2727
}

ctest/ci/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ set -ex
1010
mkdir -p target
1111
rm -rf target/libc || true
1212
git clone --depth=1 https://github.com/rust-lang/libc target/libc
13-
mkdir -p target/libc/target/ctest2
13+
mkdir -p target/libc/target/ctest
1414

1515
case $TARGET in
1616
*linux*)
17-
sed -E -i 's@ctest2 = "[0-9\.]+"@ctest2 = { path = "../../.." }@g' target/libc/libc-test/Cargo.toml
17+
sed -E -i 's@ctest = "[0-9\.]+"@ctest = { path = "../../.." }@g' target/libc/libc-test/Cargo.toml
1818
;;
1919
*apple*)
20-
sed -E -i '' 's@ctest2 = "[0-9\.]+"@ctest2 = { path = "../../.." }@g' target/libc/libc-test/Cargo.toml
20+
sed -E -i '' 's@ctest = "[0-9\.]+"@ctest = { path = "../../.." }@g' target/libc/libc-test/Cargo.toml
2121
;;
2222
esac
2323

ctest/src/lib.rs

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! # ctest2 - an FFI binding validator
1+
//! # ctest - an FFI binding validator
22
//!
33
//! This library is intended to be used as a build dependency in a separate
44
//! project from the main repo to generate tests which can be used to validate
@@ -7,12 +7,10 @@
77
//! For example usage, see the [main `README.md`][project] for how to set it
88
//! up.
99
//!
10-
//! [project]: https://github.com/JohnTitor/ctest2
10+
//! [project]: https://github.com/rust-lang/libc/blob/main/ctest/README.md
1111
1212
#![deny(missing_docs)]
1313

14-
use garando_syntax as syntax;
15-
1614
use std::collections::{HashMap, HashSet};
1715
use std::env;
1816
use std::fs::File;
@@ -21,10 +19,10 @@ use std::io::BufWriter;
2119
use std::path::{Path, PathBuf};
2220
use std::rc::Rc;
2321

22+
use garando_syntax as syntax;
2423
use syntax::abi::Abi;
2524
use syntax::ast;
26-
use syntax::ast::Attribute;
27-
use syntax::ast::Name;
25+
use syntax::ast::{Attribute, Name};
2826
use syntax::attr::{self, ReprAttr};
2927
use syntax::codemap::FilePathMapping;
3028
use syntax::config::StripUnconfigured;
@@ -185,7 +183,7 @@ impl TestGenerator {
185183
/// use std::env;
186184
/// use std::path::PathBuf;
187185
///
188-
/// use ctest2::TestGenerator;
186+
/// use ctest::TestGenerator;
189187
///
190188
/// let mut cfg = TestGenerator::new();
191189
/// cfg.header("foo.h")
@@ -201,7 +199,7 @@ impl TestGenerator {
201199
/// # Examples
202200
///
203201
/// ```no_run
204-
/// use ctest2::TestGenerator;
202+
/// use ctest::TestGenerator;
205203
///
206204
/// let mut cfg = TestGenerator::new();
207205
/// cfg.rust_version(1, 0, 1);
@@ -222,7 +220,7 @@ impl TestGenerator {
222220
/// use std::env;
223221
/// use std::path::PathBuf;
224222
///
225-
/// use ctest2::TestGenerator;
223+
/// use ctest::TestGenerator;
226224
///
227225
/// let mut cfg = TestGenerator::new();
228226
/// let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
@@ -241,7 +239,7 @@ impl TestGenerator {
241239
/// use std::env;
242240
/// use std::path::PathBuf;
243241
///
244-
/// use ctest2::{TestGenerator, Lang};
242+
/// use ctest::{TestGenerator, Lang};
245243
///
246244
/// let mut cfg = TestGenerator::new();
247245
/// cfg.language(Lang::CXX);
@@ -262,7 +260,7 @@ impl TestGenerator {
262260
/// use std::env;
263261
/// use std::path::PathBuf;
264262
///
265-
/// use ctest2::TestGenerator;
263+
/// use ctest::TestGenerator;
266264
///
267265
/// let mut cfg = TestGenerator::new();
268266
///
@@ -285,7 +283,7 @@ impl TestGenerator {
285283
/// # Examples
286284
///
287285
/// ```no_run
288-
/// use ctest2::TestGenerator;
286+
/// use ctest::TestGenerator;
289287
///
290288
/// let mut cfg = TestGenerator::new();
291289
/// cfg.out_dir("path/to/output");
@@ -303,7 +301,7 @@ impl TestGenerator {
303301
/// # Examples
304302
///
305303
/// ```no_run
306-
/// use ctest2::TestGenerator;
304+
/// use ctest::TestGenerator;
307305
///
308306
/// let mut cfg = TestGenerator::new();
309307
/// cfg.target("x86_64-unknown-linux-gnu");
@@ -321,7 +319,7 @@ impl TestGenerator {
321319
/// # Examples
322320
///
323321
/// ```no_run
324-
/// use ctest2::TestGenerator;
322+
/// use ctest::TestGenerator;
325323
///
326324
/// let mut cfg = TestGenerator::new();
327325
/// cfg.define("_GNU_SOURCE", None)
@@ -350,7 +348,7 @@ impl TestGenerator {
350348
/// # Examples
351349
///
352350
/// ```no_run
353-
/// use ctest2::TestGenerator;
351+
/// use ctest::TestGenerator;
354352
///
355353
/// let mut cfg = TestGenerator::new();
356354
/// cfg.cfg("foo", None) // cfg!(foo)
@@ -381,7 +379,7 @@ impl TestGenerator {
381379
/// # Examples
382380
///
383381
/// ```no_run
384-
/// use ctest2::TestGenerator;
382+
/// use ctest::TestGenerator;
385383
///
386384
/// let mut cfg = TestGenerator::new();
387385
/// cfg.type_name(|ty, is_struct, is_union| {
@@ -412,7 +410,7 @@ impl TestGenerator {
412410
/// # Examples
413411
///
414412
/// ```no_run
415-
/// use ctest2::TestGenerator;
413+
/// use ctest::TestGenerator;
416414
///
417415
/// let mut cfg = TestGenerator::new();
418416
/// cfg.field_name(|_s, field| {
@@ -435,7 +433,7 @@ impl TestGenerator {
435433
/// # Examples
436434
///
437435
/// ```no_run
438-
/// use ctest2::{TestGenerator, VolatileItemKind::StructField};
436+
/// use ctest::{TestGenerator, VolatileItemKind::StructField};
439437
///
440438
/// let mut cfg = TestGenerator::new();
441439
/// cfg.volatile_item(|i| {
@@ -461,7 +459,7 @@ impl TestGenerator {
461459
/// # Examples
462460
///
463461
/// ```no_run
464-
/// use ctest2::{TestGenerator};
462+
/// use ctest::{TestGenerator};
465463
///
466464
/// let mut cfg = TestGenerator::new();
467465
/// cfg.array_arg(|i, n| {
@@ -488,7 +486,7 @@ impl TestGenerator {
488486
/// # Examples
489487
///
490488
/// ```no_run
491-
/// use ctest2::TestGenerator;
489+
/// use ctest::TestGenerator;
492490
///
493491
/// let mut cfg = TestGenerator::new();
494492
/// cfg.const_cname(|c| {
@@ -514,7 +512,7 @@ impl TestGenerator {
514512
/// # Examples
515513
///
516514
/// ```no_run
517-
/// use ctest2::TestGenerator;
515+
/// use ctest::TestGenerator;
518516
///
519517
/// let mut cfg = TestGenerator::new();
520518
/// cfg.skip_field(|s, field| {
@@ -540,7 +538,7 @@ impl TestGenerator {
540538
/// # Examples
541539
///
542540
/// ```no_run
543-
/// use ctest2::TestGenerator;
541+
/// use ctest::TestGenerator;
544542
///
545543
/// let mut cfg = TestGenerator::new();
546544
/// cfg.skip_field_type(|s, field| {
@@ -565,7 +563,7 @@ impl TestGenerator {
565563
/// # Examples
566564
///
567565
/// ```no_run
568-
/// use ctest2::TestGenerator;
566+
/// use ctest::TestGenerator;
569567
///
570568
/// let mut cfg = TestGenerator::new();
571569
/// cfg.skip_signededness(|s| {
@@ -591,7 +589,7 @@ impl TestGenerator {
591589
/// # Examples
592590
///
593591
/// ```no_run
594-
/// use ctest2::TestGenerator;
592+
/// use ctest::TestGenerator;
595593
///
596594
/// let mut cfg = TestGenerator::new();
597595
/// cfg.skip_fn(|s| {
@@ -617,7 +615,7 @@ impl TestGenerator {
617615
/// # Examples
618616
///
619617
/// ```no_run
620-
/// use ctest2::TestGenerator;
618+
/// use ctest::TestGenerator;
621619
///
622620
/// let mut cfg = TestGenerator::new();
623621
/// cfg.skip_static(|s| {
@@ -660,7 +658,7 @@ impl TestGenerator {
660658
/// # Examples
661659
///
662660
/// ```no_run
663-
/// use ctest2::TestGenerator;
661+
/// use ctest::TestGenerator;
664662
///
665663
/// let mut cfg = TestGenerator::new();
666664
/// cfg.skip_const(|s| {
@@ -685,7 +683,7 @@ impl TestGenerator {
685683
/// # Examples
686684
///
687685
/// ```no_run
688-
/// use ctest2::TestGenerator;
686+
/// use ctest::TestGenerator;
689687
///
690688
/// let mut cfg = TestGenerator::new();
691689
/// cfg.skip_type(|s| {
@@ -711,7 +709,7 @@ impl TestGenerator {
711709
/// # Examples
712710
///
713711
/// ```no_run
714-
/// use ctest2::TestGenerator;
712+
/// use ctest::TestGenerator;
715713
///
716714
/// let mut cfg = TestGenerator::new();
717715
/// cfg.skip_struct(|s| {
@@ -738,7 +736,7 @@ impl TestGenerator {
738736
/// # Examples
739737
///
740738
/// ```no_run
741-
/// use ctest2::TestGenerator;
739+
/// use ctest::TestGenerator;
742740
///
743741
/// let mut cfg = TestGenerator::new();
744742
/// cfg.skip_roundtrip(|s| {
@@ -765,7 +763,7 @@ impl TestGenerator {
765763
/// # Examples
766764
///
767765
/// ```no_run
768-
/// use ctest2::TestGenerator;
766+
/// use ctest::TestGenerator;
769767
///
770768
/// let mut cfg = TestGenerator::new();
771769
/// cfg.fn_cname(|rust, link_name| link_name.unwrap_or(rust).to_string());
@@ -793,7 +791,7 @@ impl TestGenerator {
793791
/// # Examples
794792
///
795793
/// ```no_run
796-
/// use ctest2::TestGenerator;
794+
/// use ctest::TestGenerator;
797795
///
798796
/// let mut cfg = TestGenerator::new();
799797
/// cfg.generate("../path/to/libfoo-sys/lib.rs", "all.rs");

ctest/testcrate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
publish = false
88

99
[build-dependencies]
10-
ctest2 = { path = ".." }
10+
ctest = { path = ".." }
1111
cc = "1.0"
1212

1313
[dependencies]

0 commit comments

Comments
 (0)