use std::collections::HashSet;
use std::path::Path;
use cucumber::writer::Stats;
use graphdblite::tck_support::world::World;
fn main() {
std::thread::Builder::new()
.stack_size(64 * 1024 * 1024)
.spawn(run)
.expect("spawn TCK runner thread")
.join()
.expect("TCK runner thread");
}
fn run() {
let base = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("tck");
let features_dir = base.join("features");
if !features_dir.exists() {
eprintln!(
"TCK: feature directory not found at {} — skipping harness run",
features_dir.display()
);
return;
}
let skiplist = load_skiplist(&base.join("skiplist.txt"));
let skip_count = skiplist.len();
let writer = pollster::block_on(
<World as cucumber::World>::cucumber()
.before(|feat, _rule, scenario, world| {
world.current_feature = feat.name.clone();
world.current_scenario = scenario.name.clone();
Box::pin(async {})
})
.filter_run(&features_dir, move |feat, _rule, scenario| {
let key = format!("{}::{}", feat.name, scenario.name);
!skiplist.contains(key.as_str())
}),
);
if skip_count > 0 {
eprintln!("TCK: {skip_count} scenarios skipped via skiplist");
}
if writer.failed_steps() > 0 || writer.hook_errors() > 0 {
std::process::exit(1);
}
}
fn load_skiplist(path: &Path) -> HashSet<String> {
std::fs::read_to_string(path)
.unwrap_or_default()
.lines()
.map(str::trim)
.filter(|l| !l.is_empty() && !l.starts_with('#'))
.map(String::from)
.collect()
}