From af87d6cf4b3609e5ceb875bbb9ec7200729e5323 Mon Sep 17 00:00:00 2001 From: kevinnls <57634663+kevinnls@users.noreply.github.com> Date: Tue, 6 Apr 2021 12:16:17 +0530 Subject: [PATCH] misc: reorganise a bit + slightly unique `_oname`s - bc why not? - dir **tests.d** to take test scripts --- dev/.gitignore | 2 +- dev/test | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dev/.gitignore b/dev/.gitignore index 1079bf8..e93dfd3 100644 --- a/dev/.gitignore +++ b/dev/.gitignore @@ -1 +1 @@ -tests.d +test-output diff --git a/dev/test b/dev/test index 1b4241d..ee71508 100755 --- a/dev/test +++ b/dev/test @@ -4,6 +4,7 @@ set -e # set -x for debugging if DEBUG is set function debug() { set -xv; } +function get_last_commit() { git show -q --pretty='%h'; } ${DEBUG+debug} # declare project info variables @@ -13,18 +14,21 @@ project_name='stdouterr' project_version='v0.1.0-beta' project_lang='C' +curr_hash=$(get_last_commit) + script_dir="$(realpath -e $(dirname "${0}") 2>/dev/null)" project_root=${script_dir%/*} # remove everything after the final `/` test_dir="${project_root}/dev/tests.d" -[[ ! -d "${test_dir}" ]] && mkdir -p "${test_dir}" +out_dir="${project_root}/dev/test-output" +[[ ! -d "${out_dir}" ]] && mkdir -p "${out_dir}" src_dir="${project_root}/src" c_compilers=('gcc' 'clang') cpp_compilers=('g++' 'clang') -_oname="${project_name:0:5}-${project_version}~test" -oname="$test_dir/${output:-${_oname}}" +_oname="${project_name:0:5}-${project_version}~${curr_hash}_${RANDOM}" +oname="$out_dir/${output:-${_oname}}" _iname="${src_dir}/main.c" iname="${input:-${_iname}}"