misc: reorganise a bit + slightly unique _onames

- bc why not?
- dir **tests.d** to take test scripts
This commit is contained in:
kevinnls
2021-04-06 12:16:17 +05:30
parent eb60d446c7
commit af87d6cf4b
2 changed files with 8 additions and 4 deletions

2
dev/.gitignore vendored
View File

@@ -1 +1 @@
tests.d test-output

View File

@@ -4,6 +4,7 @@ set -e
# set -x for debugging if DEBUG is set # set -x for debugging if DEBUG is set
function debug() { set -xv; } function debug() { set -xv; }
function get_last_commit() { git show -q --pretty='%h'; }
${DEBUG+debug} ${DEBUG+debug}
# declare project info variables # declare project info variables
@@ -13,18 +14,21 @@ project_name='stdouterr'
project_version='v0.1.0-beta' project_version='v0.1.0-beta'
project_lang='C' project_lang='C'
curr_hash=$(get_last_commit)
script_dir="$(realpath -e $(dirname "${0}") 2>/dev/null)" script_dir="$(realpath -e $(dirname "${0}") 2>/dev/null)"
project_root=${script_dir%/*} # remove everything after the final `/` project_root=${script_dir%/*} # remove everything after the final `/`
test_dir="${project_root}/dev/tests.d" 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" src_dir="${project_root}/src"
c_compilers=('gcc' 'clang') c_compilers=('gcc' 'clang')
cpp_compilers=('g++' 'clang') cpp_compilers=('g++' 'clang')
_oname="${project_name:0:5}-${project_version}~test" _oname="${project_name:0:5}-${project_version}~${curr_hash}_${RANDOM}"
oname="$test_dir/${output:-${_oname}}" oname="$out_dir/${output:-${_oname}}"
_iname="${src_dir}/main.c" _iname="${src_dir}/main.c"
iname="${input:-${_iname}}" iname="${input:-${_iname}}"