[prev in list] [next in list] [prev in thread] [next in thread]
List: util-linux-ng
Subject: [PATCH 3/4] tests: add uuidgen output check
From: Sami Kerola <kerolasa () iki ! fi>
Date: 2015-10-25 16:04:59
Message-ID: 1445789100-1781-4-git-send-email-kerolasa () iki ! fi
[Download RAW message or body]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
tests/expected/uuid/uuidgen | 8 ++++++++
tests/ts/uuid/uuidgen | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
create mode 100644 tests/expected/uuid/uuidgen
create mode 100755 tests/ts/uuid/uuidgen
diff --git a/tests/expected/uuid/uuidgen b/tests/expected/uuid/uuidgen
new file mode 100644
index 0000000..b0d1d98
--- /dev/null
+++ b/tests/expected/uuid/uuidgen
@@ -0,0 +1,8 @@
+option: -r
+return values: 0 and 0
+option: -t
+return values: 0 and 0
+option: --random
+return values: 0 and 0
+option: --time
+return values: 0 and 0
diff --git a/tests/ts/uuid/uuidgen b/tests/ts/uuid/uuidgen
new file mode 100755
index 0000000..6aa1b5b
--- /dev/null
+++ b/tests/ts/uuid/uuidgen
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="uuidgen"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_UUID_PARSER"
+ts_check_test_command "$TS_CMD_UUIDGEN"
+
+OUTPUT_FILE="$(mktemp "${TS_OUTDIR}/uuidgenXXXXXXXXXXXXX")"
+
+test_flag() {
+ echo "option: $1" >> $TS_OUTPUT
+ $TS_CMD_UUIDGEN $1 > "$OUTPUT_FILE" 2>>$TS_OUTPUT
+ ret=$?
+ $TS_HELPER_UUID_PARSER "$OUTPUT_FILE" >> $TS_OUTPUT 2>&1
+ if [ $? -ne 0 ] || [ $ret -ne 0 ]; then
+ echo "something wrong with $OUTPUT_FILE" >> $TS_OUTPUT
+ cat $OUTPUT_FILE >> $TS_OUTPUT 2>&1
+ fi
+ echo "return values: $ret and $?" >> $TS_OUTPUT
+}
+
+test_flag -r
+test_flag -t
+test_flag --random
+test_flag --time
+
+rm -f "$OUTPUT_FILE"
+
+ts_finalize
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic