diff options
author | Daniel Díaz <daniel.diaz@linaro.org> | 2017-02-15 18:56:58 -0600 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-02-17 12:05:29 +0000 |
commit | 215b4447886ae4f13674ece020ebd09ce339c433 (patch) | |
tree | 3992c10d67b03245c482ebf8d86273d2e126ec66 /automated/lib | |
parent | 3385456e154ab69c7b5d487dffc7f0e08e722582 (diff) |
automated: sh-test-lib: add create_out_dir()
Some error checking and renaming can happen here for all
other scripts to peruse.
Change-Id: I7286cf2909c59fc41935658d0a970b9c4b7ec795
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-x | automated/lib/sh-test-lib | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib index 9030899..299964d 100755 --- a/automated/lib/sh-test-lib +++ b/automated/lib/sh-test-lib @@ -326,3 +326,12 @@ add_repo() { ;; esac } + +create_out_dir() { + [ -z "$1" ] && error_msg "Usage: create_out_dir output_dir" + OUTPUT=$1 + [ -d "${OUTPUT}" ] && + mv "${OUTPUT}" "${OUTPUT}_$(date -r "${OUTPUT}" +%Y%m%d%H%M%S)" + mkdir -p "${OUTPUT}" + [ -d "${OUTPUT}" ] || error_msg "Could not create output directory ${OUTPUT}" +} |