summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/utils.sh b/tests/utils.sh
index 6480337d..57c5b079 100644
--- a/tests/utils.sh
+++ b/tests/utils.sh
@@ -47,10 +47,16 @@ cat_entry() {
}
reset_store() {
+ rm -rf "${STORE}"/.git
rm -r "${STORE}"
}
call_test() {
+ prepare_store_directory || {
+ err "Preparing store directory failed"
+ exit 1
+ }
+
out "-- TESTING: '$1' --"
$1
result=$?
@@ -63,6 +69,27 @@ call_test() {
success "-- SUCCESS: '$1' --"
}
+__git() {
+ out "Calling git: $*"
+ git --work-tree=/tmp/store/ --git-dir=/tmp/store/.git $*
+}
+
+__git_commit() {
+ out "Calling git-commit: $*"
+ git --work-tree=/tmp/store/ --git-dir=/tmp/store/.git commit -m "$*"
+}
+
+prepare_store_directory() {
+ out "Preparing /tmp/store"
+ mkdir -p /tmp/store/ &&\
+ touch /tmp/store/.gitkeep &&\
+ __git init &&\
+ __git config --local user.email "imag@imag-pim.org" &&\
+ __git config --local user.name "Imag CI" &&\
+ __git add .gitkeep &&\
+ __git_commit 'Initial commit: .gitkeep'
+}
+
invoke_tests() {
out "Invoking tests."
if [[ ! -z "$INVOKE_TEST" ]]; then