summaryrefslogtreecommitdiff
path: root/tests/misc/arch
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2007-06-05 23:29:32 +0200
committerJim Meyering <jim@meyering.net>2007-07-10 19:00:00 +0200
commit264021699cb9a460ebcdd3d080e88d55c269cc61 (patch)
tree8aa51f56ead922e46fd2b9eeb8953be4db4de317 /tests/misc/arch
parent33342c1a0a464f198df3f177432a0e98e482e7a4 (diff)
downloadcoreutils-264021699cb9a460ebcdd3d080e88d55c269cc61.tar.xz
New program: arch
* NEWS: Mention arch. * README: Add arch to the list of programs. * AUTHORS: Add arch. * src/uname.c: Include "uname.h". (PROGRAM_NAME): Handle arch, too. (ARCH_AUTHORS): Define. (uname_long_options, arch_long_options): Renamed and new globals. (usage): Handle arch-mode as well as uname-mode. (decode_switches): New function, extracted from main, to handle arch-mode as well as uname-mode. (main): Handle both modes. * src/uname-arch.c: New program, alias for "uname -m". * src/uname-uname.c: New file, default uname mode. * src/uname.h: New file, uname modes. * src/Makefile.am (EXTRA_PROGRAMS): Add arch. (uname_SOURCES, arch_SOURCES): Define. * man/arch.x: New file. * man/Makefile.am (dist_man_MANS): Add arch.1. (arch.1): New dependency. * tests/misc/arch: New test, compare "arch" with "uname -m" * configure.ac (OPTIONAL_BIN_PROGS): Add arch. (MAN): Add arch.1. * .x-sc_require_config_h: Exempt uname-arch.c and uname-uname.c from the always-include-<config.h> rule. Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Jim Meyering <jim@meyering.net>
Diffstat (limited to 'tests/misc/arch')
-rwxr-xr-xtests/misc/arch48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/misc/arch b/tests/misc/arch
new file mode 100755
index 000000000..4773491b4
--- /dev/null
+++ b/tests/misc/arch
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Ensure that arch output is equal to uname -m
+
+# Copyright (C) 2007 Free Software Foundation, Inc.
+
+# This program 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 program 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ arch --version
+fi
+
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
+fail=0
+
+arch > out || fail=1
+uname -m > exp || fail=1
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
+(exit $fail); exit $fail