make the CI options command line driven

This commit is contained in:
bunnie 2022-01-02 16:41:23 +08:00
parent 350276c08a
commit 630dd6a784
2 changed files with 23 additions and 10 deletions

View file

@ -23,6 +23,7 @@ def main():
pass_log = {}
err_log = []
timeout = 240 # a bit longer to allow for a compilation to happen
for seed in range(0, 501):
err_log.append("Starting seed {}".format(seed))
seed_env = os.environ
@ -35,7 +36,7 @@ def main():
passing = 'PASS'
proc = subprocess.Popen(
['cargo', 'xtask', 'run'],
['cargo', 'xtask', 'pddb-ci'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
#shell=True,
@ -47,7 +48,7 @@ def main():
realtime_output = proc.stdout.readline()
if (realtime_output == '' and proc.poll() is not None) or (time.time() - start_time > 20):
proc.kill()
if time.time() - start_time > 20:
if time.time() - start_time > timeout:
logging.debug("timeout on generation")
passing = 'FAIL TIMEOUT'
break
@ -81,6 +82,8 @@ def main():
passing = 'FAIL AUTH'
proc.kill()
timeout = 20 # reset the timeout after the first run to something shorter, now that any potential compilation step is done
proc = subprocess.Popen(
['python', './tools/pddbdbg.py', '--name', args.name],
stdout=subprocess.PIPE,

View file

@ -159,7 +159,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Some("renode-aes-test") => renode_image(false, &aestest_pkgs, &[])?,
Some("renode-image-debug") => renode_image(true, &hw_pkgs, &[])?,
Some("run") => run(false, &hw_pkgs)?,
Some("run") => run(false, &hw_pkgs, None)?,
Some("pddb-ci") => run(false, &hw_pkgs, Some(
&["--features", "pddb/ci", "--features", "pddb/deterministic"]
))?,
Some("hw-image") => {
build_hw_image(false, env::args().nth(2), &hw_pkgs, lkey, kkey, None, &[])?
}
@ -172,7 +175,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
None,
&[],
)?,
Some("pddb-hosted") => run(false, &pddb_dev_pkgs)?,
Some("pddb-hosted") => run(false, &pddb_dev_pkgs, None)?,
Some("benchmark") => build_hw_image(
false,
env::args().nth(2),
@ -230,7 +233,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Some("sr-test") => {
build_hw_image(false, env::args().nth(2), &sr_pkgs, lkey, kkey, None, &[])?
}
Some("debug") => run(true, &hw_pkgs)?,
Some("debug") => run(true, &hw_pkgs, None)?,
Some("burn-kernel") => update_usb(true, false, false, false)?,
Some("burn-loader") => update_usb(false, true, false, false)?,
Some("nuke-soc") => update_usb(false, false, true, false)?,
@ -380,7 +383,7 @@ fn build_hw_image(
let kernel = build_kernel(debug)?;
let mut init = vec![];
let base_path = build(packages, debug, Some(PROGRAM_TARGET), None, extra_args)?;
let base_path = build(packages, debug, Some(PROGRAM_TARGET), None, extra_args, None)?;
for pkg in packages {
let mut pkg_path = base_path.clone();
pkg_path.push(pkg);
@ -396,7 +399,7 @@ fn build_hw_image(
debug,
Some(KERNEL_TARGET),
Some("loader".into()),
None,
None, None,
)?;
loader.push(PathBuf::from("loader"));
@ -534,10 +537,10 @@ fn renode_image(debug: bool, packages: &[&str], extra_packages: &[&str]) -> Resu
)
}
fn run(debug: bool, init: &[&str]) -> Result<(), DynError> {
fn run(debug: bool, init: &[&str], features: Option<&[&str]>) -> Result<(), DynError> {
let stream = if debug { "debug" } else { "release" };
build(init, debug, None, None, None)?;
build(init, debug, None, None, None, features)?;
// Build and run the kernel
let mut args = vec!["run"];
@ -583,7 +586,7 @@ fn build_kernel(debug: bool) -> Result<PathBuf, DynError> {
debug,
Some(KERNEL_TARGET),
Some("kernel".into()),
None,
None, None,
)?;
path.push("kernel");
Ok(path)
@ -832,11 +835,18 @@ fn build(
target: Option<&str>,
directory: Option<PathBuf>,
extra_args: Option<&[&str]>,
features: Option<&[&str]>,
) -> Result<PathBuf, DynError> {
ensure_compiler(&target)?;
let stream = if debug { "debug" } else { "release" };
let mut args = vec!["build"];
print!("Building");
if let Some(feature) = features {
for &a in feature {
args.push(a);
}
}
for package in packages {
print!(" {}", package);
args.push("--package");