Unverified Commit 061ee5c2 by Nick Hynes Committed by GitHub

Fix rust tests (#2482)

parent 0806b69e
extern crate ar; extern crate ar;
use std::{env, path::PathBuf, process::Command}; use std::{
env,
fs::File,
path::{Path, PathBuf},
process::Command,
};
use ar::Builder; use ar::Builder;
use std::fs::File;
fn main() { fn main() {
let out_dir = env::var("OUT_DIR").unwrap(); let out_dir = env::var("OUT_DIR").unwrap();
...@@ -11,12 +15,20 @@ fn main() { ...@@ -11,12 +15,20 @@ fn main() {
let output = Command::new(concat!( let output = Command::new(concat!(
env!("CARGO_MANIFEST_DIR"), env!("CARGO_MANIFEST_DIR"),
"/src/build_test_graph.py" "/src/build_test_graph.py"
)).arg(&out_dir) ))
.output() .arg(&out_dir)
.expect("Failed to execute command"); .output()
if output.stderr.len() > 0 { .expect("Failed to execute command");
panic!(String::from_utf8(output.stderr).unwrap()); assert!(
} Path::new(&format!("{}/graph.o", out_dir)).exists(),
"Could not build graph lib: {}",
String::from_utf8(output.stderr)
.unwrap()
.trim()
.split("\n")
.last()
.unwrap_or("")
);
let in_path: PathBuf = [&out_dir, "graph.o"].iter().collect(); let in_path: PathBuf = [&out_dir, "graph.o"].iter().collect();
let out_path: PathBuf = [&out_dir, "libgraph.a"].iter().collect(); let out_path: PathBuf = [&out_dir, "libgraph.a"].iter().collect();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment