2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Oracle. All Rights Reserved.
5 # Move a test and update the golden output file.
9 if [ -z "$1" ] || [ "$1" = "--help" ]; then
10 echo "Usage: $0 path_to_test new_path_to_test"
28 test "${src}" != "${dest}" || die "Test \"${src}\" is the same as dest."
29 test -e "tests/${src}" || die "Test \"${src}\" does not exist."
30 test ! -e "tests/${dest}" || die "Test \"${src}\" already exists."
32 sid="$(basename "${src}")"
33 did="$(basename "${dest}")"
35 git mv "tests/${src}" "tests/${dest}"
36 git mv "tests/${src}.out" "tests/${dest}.out"
37 sed -e "s/^# FS[[:space:]]*QA.*Test.*[0-9]\+$/# FS QA Test No. ${did}/g" -i "tests/${dest}"
38 sed -e "s/^QA output created by ${sid}$/QA output created by ${did}/g" -i "tests/${dest}.out"
39 sed -e "s/test-${sid}/test-${did}/g" -i "tests/${dest}.out"
41 echo "Moved \"${src}\" to \"${dest}\"."