Skip to content

Commit

Permalink
Use better name for temp directories
Browse files Browse the repository at this point in the history
  • Loading branch information
James Casey committed Jan 24, 2019
1 parent fa37d5f commit 38d3704
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
UNAME_S := $(shell uname -s)
HAS_DOCKER := $(shell command -v docker 2> /dev/null)
TESTING_FS_ROOT := $(shell mktemp -d /tmp/testing-fs-root-XXXXXX)
ifneq (${IN_DOCKER},)
IN_DOCKER := ${IN_DOCKER}
else ifeq ($(UNAME_S),Darwin)
Expand Down Expand Up @@ -186,7 +187,7 @@ $(foreach component,$(ALL),$(eval $(call BUILD,$(component))))

define UNIT
unit-$1: image ## executes the $1 component's unit test suite
$(run) sh -c 'cd components/$1 && cargo test $(CARGO_FLAGS)'
$(run) sh -c 'cd components/$1 && TESTING_FS_ROOT=$(TESTING_FS_ROOT) cargo test $(CARGO_FLAGS)'
.PHONY: unit-$1
endef
$(foreach component,$(ALL),$(eval $(call UNIT,$(component))))
Expand Down
12 changes: 5 additions & 7 deletions components/common/src/templating/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ fn never_escape(data: &str) -> String {

#[cfg(test)]
mod test {
use super::*;
use crate::hcore::fs::{pkg_root_path, FS_ROOT_PATH};
use crate::hcore::package::PackageIdent;
use crate::templating::test_helpers::*;
use serde_json;
use std::collections::BTreeMap;
use std::env;
Expand All @@ -127,12 +131,6 @@ mod test {
use tempfile::TempDir;
use toml;

use crate::hcore::fs::FS_ROOT_PATH;
use crate::hcore::package::PackageIdent;

use super::*;
use crate::templating::test_helpers::*;

pub fn root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests")
}
Expand Down Expand Up @@ -309,7 +307,7 @@ test: something"#
let rendered = renderer.render("t", &data).unwrap();
assert_eq!(
PathBuf::from(rendered),
(&*FS_ROOT_PATH).join("/hab/pkgs/core/acl/2.2.52/20161208223311",)
pkg_root_path(Some(&*FS_ROOT_PATH)).join("core/acl/2.2.52/20161208223311",)
);
}

Expand Down
3 changes: 0 additions & 3 deletions support/ci/rust_tests.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

sudo mkdir -p /hab
sudo chmod o+w /hab

git log HEAD~1..HEAD | grep -q '!!! Temporary Commit !!!'
is_tmp_commit=$?

Expand Down

0 comments on commit 38d3704

Please sign in to comment.