From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com, darrick.wong@oracle.com
Cc: fstests@vger.kernel.org, xfs@oss.sgi.com, hch@infradead.org,
tao.peng@primarydata.com, linux-ext4@vger.kernel.org,
Anna.Schumaker@netapp.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 01/12] test-scripts: test migration scripts
Date: Fri, 13 Nov 2015 13:36:50 -0800 [thread overview]
Message-ID: <20151113213650.31124.16817.stgit@birch.djwong.org> (raw)
In-Reply-To: <20151113213643.31124.80975.stgit@birch.djwong.org>
Add two scripts: "nextid" finds the next available test ID number in a
group, and "mvtest" relocates a test, fixes the golden output, and
moves the group entry for that test.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
mvtest | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
nextid | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+)
create mode 100755 mvtest
create mode 100755 nextid
diff --git a/mvtest b/mvtest
new file mode 100755
index 0000000..b5406d1
--- /dev/null
+++ b/mvtest
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Renumber a test
+
+if [ -z "$1" ] || [ "$1" = "--help" ]; then
+ echo "Usage: $0 path_to_test new_path_to_test"
+ exit 1
+fi
+
+src="$1"
+dest="$2"
+
+die() {
+ echo "$@"
+ exit 1
+}
+
+nsort() {
+ sort -g < "$1" > "$2"
+}
+
+append() {
+ out="$1"
+ shift
+ echo "$@" >> "${out}"
+}
+
+test "${src}" != "${dest}" || die "Test \"${src}\" is the same as dest."
+test -e "tests/${src}" || die "Test \"${src}\" does not exist."
+test ! -e "tests/${dest}" || die "Test \"${src}\" already exists."
+
+sid="$(basename "${src}")"
+did="$(basename "${dest}")"
+
+sgroup="$(basename "$(dirname "tests/${src}")")"
+dgroup="$(basename "$(dirname "tests/${dest}")")"
+
+sgroupfile="tests/${sgroup}/group"
+dgroupfile="tests/${sgroup}/group"
+
+$DBG git mv "tests/${src}" "tests/${dest}"
+$DBG git mv "tests/${src}.out" "tests/${dest}.out"
+$DBG sed -e "s/^# FS QA Test No. ${sid}$/# FS QA Test No. ${did}/g" -i "tests/${dest}"
+$DBG sed -e "s/^QA output created by ${sid}$/QA output created by ${did}/g" -i "tests/${dest}.out"
+$DBG sed -e "s/test-${sid}/test-${did}/g" -i "tests/${dest}.out"
+
+grpline="$(grep "^${sid} " "${sgroupfile}")"
+newgrpline="$(echo "${grpline}" | sed -e "s/^${sid} /${did} /g")"
+
+$DBG sed -e "/^${sid}.*$/d" -i "${sgroupfile}"
+$DBG cp "${dgroupfile}" "${dgroupfile}.new"
+$DBG append "${dgroupfile}.new" "${newgrpline}"
+$DBG nsort "${dgroupfile}.new" "${dgroupfile}"
+$DBG rm "${dgroupfile}.new"
+
+echo "Moved \"${src}\" to \"${dest}\"."
+
+exit 0
diff --git a/nextid b/nextid
new file mode 100755
index 0000000..285b549
--- /dev/null
+++ b/nextid
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Given a group name, find the next available test number.
+
+if [ -z "$1" ] || [ "$1" = "--help" ]; then
+ echo "Usage: $0 groupname[/start_looking_at_this_number]"
+ exit 1
+fi
+
+die() {
+ echo "$@"
+ exit 1
+}
+
+if [ "$(basename "$1")" != "$1" ]; then
+ group="$(dirname "$1")"
+ id="$(basename "$1")"
+else
+ group="$1"
+ id=1
+fi
+test -e "tests/${group}/group" || die "Unknown group \"${group}\"."
+
+while test "${id}" -lt 1000; do
+ name="$(printf "%.03d" "${id}")"
+ if [ ! -e "tests/${group}/${name}" ]; then
+ echo "${group}/${name}"
+ exit 0
+ fi
+ id=$((id + 1))
+done
+
+echo "No free IDs less than ${id} in group \"${group}\"."
+
+exit 1
next prev parent reply other threads:[~2015-11-13 21:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 21:36 [RFCv3.2 00/12] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2015-11-13 21:36 ` Darrick J. Wong [this message]
2015-11-16 20:58 ` [PATCH 01/12] test-scripts: test migration scripts Dave Chinner
2015-11-16 23:51 ` Darrick J. Wong
2015-11-17 21:16 ` Darrick J. Wong
2015-11-13 21:36 ` [PATCH 02/12] btrfs: move btrfs reflink tests to generic Darrick J. Wong
2015-11-13 21:37 ` [PATCH 03/12] reflink: add test support routines to a separate file Darrick J. Wong
2015-11-13 21:37 ` [PATCH 04/12] reflink: basic tests of the reflink and dedupe ioctls Darrick J. Wong
2015-11-13 21:37 ` [PATCH 05/12] reflink: test CoW behaviors of reflinked files Darrick J. Wong
2015-11-13 21:37 ` [PATCH 06/12] reflink: test the various fallocate modes Darrick J. Wong
2015-11-13 21:37 ` [PATCH 07/12] reflink: test accuracy of free block counts Darrick J. Wong
2015-11-13 21:37 ` [PATCH 08/12] reflink: test error conditions due to bad inputs Darrick J. Wong
2015-11-13 21:37 ` [PATCH 09/12] xfs: test xfs-specific reflink pieces Darrick J. Wong
2015-11-13 21:37 ` [PATCH 10/12] reflink: concurrent operations tests Darrick J. Wong
2015-11-13 21:37 ` [PATCH 11/12] reflink: test that CoW writes fail when we're out of space Darrick J. Wong
2015-11-13 21:38 ` [PATCH 12/12] reflink: test what happens when we hit resource limits Darrick J. Wong
2015-11-14 8:41 ` [RFCv3.2 00/12] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151113213650.31124.16817.stgit@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=Anna.Schumaker@netapp.com \
--cc=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=hch@infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tao.peng@primarydata.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).