Initial commit

This commit is contained in:
David Venhoff 2025-07-31 13:31:42 +02:00
commit c8b055f7d8
4 changed files with 1184 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1133
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

7
Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "qemu-nyx-runner"
version = "0.1.0"
edition = "2024"
[dependencies]
libnyx = { git = "https://git.cs.tu-dortmund.de/david.venhoff/libnyx-fork" }

43
src/main.rs Normal file
View File

@ -0,0 +1,43 @@
//! Translated from libnyx/test.c
use libnyx::{NyxConfig, NyxProcess, NyxProcessRole};
use std::error::Error;
use std::fs::File;
use std::os::fd::AsRawFd;
use libnyx::ffi::nyx_print_aux_buffer;
const WORKDIR_PATH: &'static str = "/tmp/wdir";
fn main() -> Result<(), Box<dyn Error>> {
let mut nyx_config = NyxConfig::load("/fs/scratch/smdavenh/nyx-bench/build")?;
nyx_config.set_workdir_path(WORKDIR_PATH.to_string());
nyx_config.set_input_buffer_size(0x2000);
// let file = File::create("/tmp/nyx_test_output.log")?;
// let fd = file.as_raw_fd();
// test.c never closes the file, and closing it throws a warning...
// std::mem::forget(file);
// nyx_config.set_hprintf_fd(fd);
nyx_config.set_process_role(NyxProcessRole::StandAlone);
nyx_config.print();
let mut nyx_runner = NyxProcess::new(&mut nyx_config, 0)?;
nyx_runner.set_input(b"INPUT", 5);
nyx_runner.option_set_reload_mode(true);
nyx_runner.option_set_trace_mode(true);
nyx_runner.option_set_timeout(10, 0);
nyx_runner.option_apply();
for _ in 0..1 {
let result = nyx_runner.exec();
println!("{result}");
nyx_print_aux_buffer(&mut nyx_runner as *mut _);
}
nyx_runner.shutdown();
// std::fs::remove_dir_all(WORKDIR_PATH)?;
Ok(())
}