Merge remote-tracking branch 'upstream/master'
diff --git a/configure.ac b/configure.ac
index f217f50..f0fc6b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,5 +167,6 @@
LTP_CHECK_ACL_SUPPORT
LTP_CHECK_FS_IOC_FLAGS
LTP_CHECK_MREMAP_FIXED
+LTP_CHECK_KERNEL_DEVEL
AC_OUTPUT
diff --git a/include/mk/config.mk.default b/include/mk/config.mk.default
index bd364a6..953747c 100644
--- a/include/mk/config.mk.default
+++ b/include/mk/config.mk.default
@@ -73,4 +73,10 @@
CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
+LINUX_VERSION :=
+LINUX_DIR :=
+LINUX_VERSION_MAJOR :=
+LINUX_VERSION_PATCH :=
+WITH_MODULES := no
+
export datarootdir includedir libdir mandir prefix
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index b835c86..96633f1 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -75,6 +75,12 @@
CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
+LINUX_VERSION := @LINUX_VERSION@
+LINUX_DIR := @LINUX_DIR@
+LINUX_VERSION_MAJOR := @LINUX_VERSION_MAJOR@
+LINUX_VERSION_PATCH := @LINUX_VERSION_PATCH@
+WITH_MODULES := @WITH_MODULES@
+
ifeq ($(strip $(prefix)),)
$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree)
endif
diff --git a/include/safe_file_ops.h b/include/safe_file_ops.h
index ad1eec8..7ff5baa 100644
--- a/include/safe_file_ops.h
+++ b/include/safe_file_ops.h
@@ -22,10 +22,10 @@
*/
/*
-
+
This code helps with file reading/writing files providing scanf/printf like
interface that opens and closes the file automatically.
-
+
This kind of interface is especially useful for reading/writing values
from/to pseudo filesystems like procfs or sysfs.
diff --git a/include/safe_macros.h b/include/safe_macros.h
index 3a26df6..adf4d09 100644
--- a/include/safe_macros.h
+++ b/include/safe_macros.h
@@ -23,7 +23,8 @@
#include <libgen.h>
#include <stdarg.h>
#include <unistd.h>
-#include <stdio.h>
+
+#include "safe_stdio.h"
char* safe_basename(const char *file, const int lineno,
void (*cleanup_fn)(void), char *path);
@@ -174,15 +175,5 @@
#define SAFE_SYSCONF(cleanup_fn, name) \
safe_sysconf(__FILE__, __LINE__, cleanup_fn, name)
-FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void),
- const char *path, const char *mode);
-#define SAFE_FOPEN(cleanup_fn, path, mode) \
- safe_fopen(__FILE__, __LINE__, cleanup_fn, path, mode)
-
-int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void),
- FILE *f);
-#define SAFE_FCLOSE(cleanup_fn, f) \
- safe_fclose(__FILE__, __LINE__, cleanup_fn, f)
-
#endif /* __SAFE_MACROS_H__ */
#endif /* __TEST_H__ */
diff --git a/include/safe_stdio.h b/include/safe_stdio.h
new file mode 100644
index 0000000..a4e3da0
--- /dev/null
+++ b/include/safe_stdio.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * 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 would 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 the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __SAFE_STDIO_H__
+#define __SAFE_STDIO_H__
+
+#include <stdio.h>
+
+FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void),
+ const char *path, const char *mode);
+#define SAFE_FOPEN(cleanup_fn, path, mode) \
+ safe_fopen(__FILE__, __LINE__, cleanup_fn, path, mode)
+
+int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void),
+ FILE *f);
+#define SAFE_FCLOSE(cleanup_fn, f) \
+ safe_fclose(__FILE__, __LINE__, cleanup_fn, f)
+
+int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void),
+ char **strp, const char *fmt, ...);
+#define SAFE_ASPRINTF(cleanup_fn, strp, fmt, ...) \
+ safe_asprintf(__FILE__, __LINE__, cleanup_fn, strp, fmt, __VA_ARGS__)
+
+#endif /* __SAFE_STDIO_H__ */
diff --git a/include/test.h b/include/test.h
index ee3efc3..a76fafc 100644
--- a/include/test.h
+++ b/include/test.h
@@ -173,6 +173,13 @@
void tst_getkver(int *k1, int *k2, int *k3);
int tst_kvercmp(int r1, int r2, int r3);
+struct tst_kern_exv {
+ char *dist_name;
+ char *extra_ver;
+};
+
+int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers);
+
/* lib/tst_is_cwd.c */
int tst_is_cwd_nfs(void);
int tst_is_cwd_v9fs(void);
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index fb02796..4da9914 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -438,32 +438,3 @@
return rval;
}
-
-FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void),
- const char *path, const char *mode)
-{
- FILE *f = fopen(path, mode);
-
- if (f == NULL) {
- tst_brkm(TBROK | TERRNO, cleanup_fn,
- "fopen(%s) failed at %s:%d", path, file, lineno);
- return NULL;
- }
-
- return f;
-}
-
-int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void),
- FILE *f)
-{
- int ret;
-
- ret = fclose(f);
-
- if (ret) {
- tst_brkm(TBROK | TERRNO, cleanup_fn,
- "fclose failed at %s:%d", file, lineno);
- }
-
- return ret;
-}
diff --git a/lib/safe_stdio.c b/lib/safe_stdio.c
new file mode 100644
index 0000000..d9a2529
--- /dev/null
+++ b/lib/safe_stdio.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * 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 would 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 the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define _GNU_SOURCE
+#include <stdarg.h>
+#include <stdio.h>
+#include "test.h"
+#include "safe_stdio.h"
+
+FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void),
+ const char *path, const char *mode)
+{
+ FILE *f = fopen(path, mode);
+
+ if (f == NULL) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "fopen(%s) failed at %s:%d", path, file, lineno);
+ return NULL;
+ }
+
+ return f;
+}
+
+int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void),
+ FILE *f)
+{
+ int ret;
+
+ ret = fclose(f);
+
+ if (ret) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "fclose failed at %s:%d", file, lineno);
+ }
+
+ return ret;
+}
+
+int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void),
+ char **strp, const char *fmt, ...)
+{
+ int ret;
+ va_list va;
+
+ va_start(va, fmt);
+ ret = vasprintf(strp, fmt, va);
+ va_end(va);
+
+ if (ret < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "asprintf failed at %s:%d", file, lineno);
+ }
+
+ return ret;
+}
diff --git a/lib/tst_kvercmp.c b/lib/tst_kvercmp.c
index cb4fd67..be4148a 100644
--- a/lib/tst_kvercmp.c
+++ b/lib/tst_kvercmp.c
@@ -34,15 +34,13 @@
#include <unistd.h>
#include <string.h>
#include <sys/utsname.h>
+#include "test.h"
void get_kver(int *k1, int *k2, int *k3)
{
struct utsname uval;
char *kver;
char *r1, *r2, *r3;
-#if !defined(linux)
- extern char *strsep(); /* shut up some compilers */
-#endif
uname(&uval);
kver = uval.release;
@@ -66,3 +64,50 @@
return currver - testver;
}
+
+static int tst_kexvcmp(char *tst_exv, char *cur_ver)
+{
+ int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0;
+ int t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0;
+ int ret;
+
+ sscanf(cur_ver, "%d.%d.%d-%d.%d", &c1, &c2, &c3, &c4, &c5);
+ sscanf(tst_exv, "%d.%d.%d-%d.%d", &t1, &t2, &t3, &t4, &t5);
+
+ if ((ret = c1 - t1))
+ return ret;
+ if ((ret = c2 - t2))
+ return ret;
+ if ((ret = c3 - t3))
+ return ret;
+ if ((ret = c4 - t4))
+ return ret;
+
+ return c5 - t5;
+}
+
+int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers)
+{
+ int i;
+ struct utsname uval;
+ char *kver;
+ const char *cur_dist_name = NULL;
+
+ uname(&uval);
+ kver = uval.release;
+ if (strstr(kver, ".el5")) {
+ cur_dist_name = "RHEL5";
+ } else if (strstr(kver, ".el6")) {
+ cur_dist_name = "RHEL6";
+ }
+
+ for (i = 0; vers[i].dist_name; i++) {
+ if (!strcmp(vers[i].dist_name, cur_dist_name)) {
+ tst_resm(TINFO, "Detected %s using kernel version %s",
+ cur_dist_name, kver);
+ return tst_kexvcmp(vers[i].extra_ver, kver);
+ }
+ }
+
+ return tst_kvercmp(r1, r2, r3);
+}
diff --git a/m4/ltp-kernel_devel.m4 b/m4/ltp-kernel_devel.m4
new file mode 100644
index 0000000..ba53bc1
--- /dev/null
+++ b/m4/ltp-kernel_devel.m4
@@ -0,0 +1,76 @@
+dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+dnl
+dnl This program is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 2 of
+dnl the License, or (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it would be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write the Free Software Foundation,
+dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
+dnl
+
+dnl
+dnl LTP_CHECK_KERNEL_DEVEL
+dnl ----------------------------
+dnl Building kernel modules
+dnl requires kernel-devel installed
+dnl
+
+AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[dnl
+
+AC_MSG_CHECKING([for kernel-devel])
+AC_ARG_WITH(
+ [linux-version],
+ [AC_HELP_STRING([--with-linux-version=VERSION],
+ [specify the Linux version to build modules for])],
+ [LINUX_VERSION="${withval}"],
+ AS_IF([test "$cross_compiling" = "no"],
+ [LINUX_VERSION=`uname -r`]))
+
+AC_SUBST(LINUX_VERSION)
+
+AC_ARG_WITH([linux-dir],
+ [AC_HELP_STRING([--with-linux-dir=DIR],
+ [specify path to kernel-devel directory])],
+ [LINUX_DIR="${withval}"],
+ AS_IF([test -n "$LINUX_VERSION"],
+ [LINUX_DIR="/lib/modules/$LINUX_VERSION/build"]))
+
+AC_SUBST(LINUX_DIR)
+
+if test -f "$LINUX_DIR/Makefile"; then
+ LINUX_VERSION_MAJOR=`sed -n '0,/^VERSION = [[0-9]]*/s,\
+^VERSION = ,,p' ${LINUX_DIR}/Makefile`
+
+ LINUX_VERSION_PATCH=`sed -n '0,/^PATCHLEVEL = [[0-9]]*/s,\
+^PATCHLEVEL = ,,p' ${LINUX_DIR}/Makefile`
+fi
+
+if [[ -n "$LINUX_VERSION_MAJOR" -a -n "$LINUX_VERSION_PATCH" ]]; then
+ WITH_MODULES="yes"
+else
+ WITH_MODULES="no"
+fi
+
+AC_SUBST(LINUX_VERSION_MAJOR)
+AC_SUBST(LINUX_VERSION_PATCH)
+
+AC_MSG_RESULT([$WITH_MODULES])
+
+AC_ARG_WITH(
+ [modules],
+ [AC_HELP_STRING([--without-modules],
+ [disable auto-building kernel modules])],
+ [WITH_MODULES="no"],
+ [])
+
+AC_SUBST(WITH_MODULES)
+])
diff --git a/runltp b/runltp
index 1309d0a..28e6bed 100755
--- a/runltp
+++ b/runltp
@@ -1001,11 +1001,18 @@
echo "losetup failed to create block device"
return 1
else
+ DEVICE_FS_TYPE="ext4"
mkfs.ext4 $LOOP_DEV
- [ $? -ne 0 ] && (echo "creating a ext4 block device failed" && return 1)
+ if [ $? -ne 0 ]; then
+ DEVICE_FS_TYPE="ext3"
+ mkfs.ext3 $LOOP_DEV
+ if [ $? -ne 0 ]; then
+ echo "creating an ext4/3 block device failed."
+ return 1
+ fi
+ fi
#set the values in alltests which require block device.
DEVICE=$LOOP_DEV
- DEVICE_FS_TYPE="ext4"
return 0
fi
fi
@@ -1015,7 +1022,6 @@
cleanup()
{
[ "$LOOP_DEV" ] && losetup -d $LOOP_DEV
- [ -e "${TEMP}/test.img" ] && rm -f ${TEMP}/test.img
rm -rf ${TMP}
}
diff --git a/runtest/kernel_misc b/runtest/kernel_misc
index 47a667e..73e21a7 100644
--- a/runtest/kernel_misc
+++ b/runtest/kernel_misc
@@ -1 +1,2 @@
kmsg01 kmsg01
+fw_load fw_load
diff --git a/runtest/syscalls b/runtest/syscalls
index beb8782..76858ed 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -579,6 +579,8 @@
mount02 mount02 -D DEVICE -T DEVICE_FS_TYPE
mount03 mount03 -D DEVICE -T DEVICE_FS_TYPE
mount04 mount04 -D DEVICE -T DEVICE_FS_TYPE
+mount05 mount05
+mount06 mount06 -D DEVICE -T DEVICE_FS_TYPE
move_pages01 move_pages.sh 01
move_pages02 move_pages.sh 02
diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
index f8615dc..16b425d 100755
--- a/testcases/commands/cron/cron02
+++ b/testcases/commands/cron/cron02
@@ -52,29 +52,10 @@
}
fi
- # running under systemd?
- if command -v systemctl >/dev/null 2>&1; then
- HAVE_SYSTEMCTL=true
+ if [ -n "$CROND_DAEMON" ]; then
+ restart_daemon $CROND_DAEMON
else
- HAVE_SYSTEMCTL=false
- fi
-
- # restart cron daemon
- # Red Hat uses crond, SuSE/Other uses cron.
- if [ -x /etc/init.d/crond ]; then
- /etc/init.d/crond restart
- elif [ -x /etc/init.d/cron ]; then
- /etc/init.d/cron restart
- elif $HAVE_SYSTEMCTL; then
- for crond in "crond" "cron"; do
- if systemctl is-enabled $crond.service >/dev/null 2>&1; then
- systemctl restart $crond.service
- break
- fi
- done
- else
- echo "Could not determine cron init.d script."
- exit 1
+ tst_brkm TBROK "Couldn't find crond or cron"
fi
}
@@ -90,6 +71,8 @@
#-----------------------------------------------------------------------
# FUNCTION: MAIN
#-----------------------------------------------------------------------
+. cmdlib.sh
+
do_setup
cron_pos_tests.sh $TEST_USER
EXIT_CODE=$?
diff --git a/testcases/commands/cron/cron_tests.sh b/testcases/commands/cron/cron_tests.sh
index b53a53a..3f70a23 100644
--- a/testcases/commands/cron/cron_tests.sh
+++ b/testcases/commands/cron/cron_tests.sh
@@ -57,6 +57,17 @@
LTPBIN=$LTPROOT/testcases/bin
fi
+. cmdlib.sh
+SYSLOG_STARTED=0
+
+if [ -n "$SYSLOG_DAEMON" ]; then
+ status_daemon $SYSLOG_DAEMON
+ if [ $? -ne 0 ]; then
+ restart_daemon $SYSLOG_DAEMON
+ SYSLOG_STARTED=1
+ fi
+fi
+
# Set return code RC variable to 0, it will be set with a non-zero return code
# in case of error. Set TFAILCNT to 0, increment if there occures a failure.
@@ -400,4 +411,8 @@
TFAILCNT=$(( $TFAILCNT+1 ))
fi
+if [ $SYSLOG_STARTED -eq 1 ]; then
+ stop_daemon $SYSLOG_DAEMON
+fi
+
exit $TFAILCNT
diff --git a/testcases/commands/sssd/sssd-lib.sh b/testcases/commands/sssd/sssd-lib.sh
index e434efe..d63ed6d 100755
--- a/testcases/commands/sssd/sssd-lib.sh
+++ b/testcases/commands/sssd/sssd-lib.sh
@@ -39,21 +39,10 @@
CONFIG_FILE="/etc/sssd/sssd.conf"
NSS_CONFIG_FILE="/etc/nsswitch.conf"
-SSSD_INIT_SCRIPT="/etc/init.d/sssd"
-
-# Command to restart sssd daemon.
-SSSD_RESTART_CMD=
# number of seconds to wait for another sssd test to complete
WAIT_COUNT=30
-# running under systemd?
-if command -v systemctl >/dev/null 2>&1; then
- HAVE_SYSTEMCTL=1
-else
- HAVE_SYSTEMCTL=0
-fi
-
cleanup()
{
disable_traps
@@ -65,7 +54,11 @@
mv $NSS_CONFIG_FILE.ltpback $NSS_CONFIG_FILE
# Make sure that restart_sssd_daemon doesn't loop
# back to cleanup again.
- restart_sssd_daemon "return 1"
+ if [ $SSSD_STARTED -eq 1 ]; then
+ stop_daemon sssd
+ else
+ restart_sssd_daemon "return 1"
+ fi
# Maintain any nonzero exit codes
if [ $exit_code -ne $? ]; then
exit_code=1
@@ -98,30 +91,6 @@
cleanup 0
fi
- SVCNAME=$(basename $SSSD_INIT_SCRIPT)
- if [ $HAVE_SYSTEMCTL == 1 ]; then
- for svc in "$SVCNAME" "sssd"; do
- if systemctl is-enabled $svc.service >/dev/null 2>&1
- then
- SSSD_RESTART_CMD="systemctl restart $svc.service"
- break
- fi
- done
- else
- for SSSD_INIT_SCRIPT in "$SSSD_INIT_SCRIPT" "/etc/init.d/sssd"
- do
- if [ -x "$SSSD_INIT_SCRIPT" ]; then
- SSSD_RESTART_CMD="$SSSD_INIT_SCRIPT restart"
- break
- fi
- done
- fi
-
- if [ -z "$SSSD_RESTART_CMD" ]; then
- tst_resm TBROK "Don't know how to restart $SVCNAME"
- cleanup 1
- fi
-
# Back up configuration file
if [ -f "$CONFIG_FILE" ]; then
# Pause if another LTP sssd test is running
@@ -163,8 +132,8 @@
cleanup_command=$1
fi
- tst_resm TINFO "restarting sssd daemon via $SSSD_RESTART_CMD"
- $SSSD_RESTART_CMD > /dev/null 2>&1
+ tst_resm TINFO "restarting sssd daemon"
+ restart_daemon sssd
if [ $? -eq 0 ]; then
# wait sssd restart success.
sleep 1
@@ -195,13 +164,19 @@
. cmdlib.sh
+SSSD_STARTED=0
+status_daemon sssd
+if [ $? -ne 0 ]; then
+ SSSD_STARTED=1
+fi
+
# determine sssd.conf can support override_gid?
setup
make_config_file
sed -i -e "/\[domain\/LOCAL\]/ a\override_gid = error" $CONFIG_FILE
# make sure config file is OK
sleep 1
-$SSSD_RESTART_CMD > /dev/null 2>&1
+restart_daemon sssd
if [ $? -ne 1 ]; then
tst_resm TCONF "override_gid does not exist. Skipping all testcases"
diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
index 4b4800d..811fcca 100644
--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -38,10 +38,12 @@
SUBDIRS += connectors \
containers \
controllers \
+ firmware \
fs \
hotplug \
io \
ipc \
+ logging \
mem \
numa \
performance_counters \
diff --git a/testcases/kernel/firmware/Makefile b/testcases/kernel/firmware/Makefile
new file mode 100644
index 0000000..dd2c62d
--- /dev/null
+++ b/testcases/kernel/firmware/Makefile
@@ -0,0 +1,44 @@
+# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+#
+# 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 would 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 the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+top_srcdir ?= ../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+SUBDIRS =
+REQ_VERSION_MAJOR = 3
+REQ_VERSION_PATCH = 7
+
+ifeq ($(MAKECMDGOALS),clean)
+SKIP = 0
+endif
+
+ifeq ($(WITH_MODULES),yes)
+SKIP ?= $(shell test $(LINUX_VERSION_MAJOR) -gt $(REQ_VERSION_MAJOR); echo $$?)
+ifeq ($(SKIP),1)
+SKIP = $(shell test $(LINUX_VERSION_MAJOR) -eq $(REQ_VERSION_MAJOR); echo $$?)
+ifeq ($(SKIP),0)
+SKIP = $(shell test $(LINUX_VERSION_PATCH) -ge $(REQ_VERSION_PATCH); echo $$?)
+endif
+endif
+endif
+
+ifeq ($(SKIP),0)
+SUBDIRS += fw_load_kernel
+endif
+SUBDIRS += fw_load_user
+
+include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/firmware/fw_load_kernel/.gitignore b/testcases/kernel/firmware/fw_load_kernel/.gitignore
new file mode 100644
index 0000000..180072a
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_kernel/.gitignore
@@ -0,0 +1,6 @@
+/ltp_fw_load.ko
+/*.cmd
+/modules.order
+/Module.symvers
+/ltp_fw_load.mod.c
+/.tmp_versions/
diff --git a/testcases/kernel/firmware/fw_load_kernel/Makefile b/testcases/kernel/firmware/fw_load_kernel/Makefile
new file mode 100644
index 0000000..076d4ed
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_kernel/Makefile
@@ -0,0 +1,42 @@
+# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+#
+# 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 would 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 the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ifneq ($(KERNELRELEASE),)
+
+ifdef CONFIG_FW_LOADER
+obj-m := ltp_fw_load.o
+endif
+
+else
+
+top_srcdir ?= ../../../..
+include $(top_srcdir)/include/mk/env_pre.mk
+
+MAKE_TARGETS := ltp_fw_load.ko
+
+# Ignoring the exit status of commands is done to be forward compatible with
+# kernel internal API changes. The user-space test will return TCONF, if it
+# doesn't find the module (i.e. it wasn't built either due to kernel-devel
+# missing or module build failure).
+ltp_fw_load.ko: ltp_fw_load.c
+ -$(MAKE) -C $(LINUX_DIR) M=$(abs_srcdir)
+ -mv ltp_fw_load.ko ltp_fw_load.ko~
+ -$(MAKE) -C $(LINUX_DIR) M=$(abs_srcdir) clean
+ -mv ltp_fw_load.ko~ ltp_fw_load.ko
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+endif
diff --git a/testcases/kernel/firmware/fw_load_kernel/README b/testcases/kernel/firmware/fw_load_kernel/README
new file mode 100644
index 0000000..97507fd
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_kernel/README
@@ -0,0 +1,16 @@
+The aim of the test is to check device firmware loading. Since kernel 3.7
+firmware loading changed to direct loading (by-pass udev). The test consists
+of the two parts:
+ - userspace part
+ - kernelspace part
+
+This is a kernel module, which is a part of the device firmware loading test.
+It allows to call request_firmware kernel function with specified parameters.
+Template firmware file name and expected firmware file's data size are passed
+as the insmod command line parameters. Then, the number of firmware test files
+should be written to sysfs file 'fwnum' (the maximum number is 32). This write
+will initiate request firmware procedure. In the end, results can be read from
+'result' device sysfs file. Also, some information regarding module loading,
+can be obtained by looking at kernel log file.
+
+It is automatically used by userspace part of the test.
diff --git a/testcases/kernel/firmware/fw_load_kernel/ltp_fw_load.c b/testcases/kernel/firmware/fw_load_kernel/ltp_fw_load.c
new file mode 100644
index 0000000..b7397e8
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_kernel/ltp_fw_load.c
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * 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 would 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 the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Alexey Kodanev <alexey.kodanev@oracle.com>
+ *
+ * This module is trying to load external test firmware files (n#_load_tst.fw).
+ * In the end, it writes results to /sys/devices/ltp_fw_load/result file.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/string.h>
+#include <linux/firmware.h>
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexey Kodanev <alexey.kodanev@oracle.com>");
+MODULE_DESCRIPTION("This module is checking device firmware loading");
+
+#define TCID "ltp_fw_load"
+
+static char *fw_name = "load_tst.fw";
+static int fw_size = 0x1000;
+static int max_name = 64;
+static int fw;
+
+module_param(fw_name, charp, 0444);
+MODULE_PARM_DESC(fw_name, "Template firmware file name: n#_name");
+
+module_param(fw_size, int, 0444);
+MODULE_PARM_DESC(fw_size, "Firmware file size");
+
+/*
+ * bit mask for each test-case,
+ * if test is passed, bit will be set to 1
+ */
+static int test_result;
+
+static void device_release(struct device *dev)
+{
+ pr_info(TCID ": device released\n");
+}
+
+static struct device tdev = {
+ .init_name = TCID,
+ .release = device_release,
+};
+
+/* read and print firmware data */
+static int fw_read(const u8 *data, size_t size)
+{
+ size_t i;
+ pr_info(TCID ": Firmware has size '%zu'\n", size);
+ if (size != fw_size) {
+ pr_err(TCID ": Expected firmware size '%d'\n", fw_size);
+ return -1;
+ }
+ for (i = 0; i < size; ++i) {
+ if (data[i] != (u8)fw) {
+ pr_err(TCID ": Unexpected firmware data\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int try_request_fw(const char *name)
+{
+ int err;
+ const struct firmware *fw_entry = NULL;
+ err = request_firmware(&fw_entry, name, &tdev);
+ if (!err) {
+ pr_info(TCID ": firmware '%s' requested\n", name);
+ err = fw_read(fw_entry->data, fw_entry->size);
+ } else
+ pr_err(TCID ": Can't request firmware '%s'\n", name);
+ release_firmware(fw_entry);
+ return err;
+}
+
+/* print test result to sysfs file */
+static ssize_t sys_result(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return scnprintf(buf, PAGE_SIZE, "%d\n", test_result);
+}
+static DEVICE_ATTR(result, S_IRUSR, sys_result, NULL);
+
+/*
+ * get the number of firmware files and
+ * perform firmware requests
+ */
+static ssize_t sys_fwnum(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int err, fw_num = 0;
+
+ sscanf(buf, "%d", &fw_num);
+ if (fw_num <= 0 || fw_num > 32) {
+ pr_err(TCID ": Unexpected number of firmwares '%d'", fw_num);
+ return count;
+ }
+ for (fw = 0; fw < fw_num; ++fw) {
+ char name[max_name];
+ snprintf(name, max_name, "n%d_%s", fw, fw_name);
+ err = try_request_fw(name);
+ test_result |= (err == 0) << fw;
+ }
+ return count;
+}
+static DEVICE_ATTR(fwnum, S_IWUSR, NULL, sys_fwnum);
+
+static int test_init(void)
+{
+ int err;
+
+ err = device_register(&tdev);
+ if (err) {
+ pr_err(TCID ": Unable to register device\n");
+ return err;
+ }
+ pr_info(TCID ": device registered\n");
+
+ err = device_create_file(&tdev, &dev_attr_result);
+ if (err) {
+ pr_err(TCID ": Can't create sysfs file 'result'\n");
+ device_unregister(&tdev);
+ return err;
+ }
+ err = device_create_file(&tdev, &dev_attr_fwnum);
+ if (err) {
+ pr_err(TCID ": Can't create sysfs file 'fwnum'\n");
+ device_remove_file(&tdev, &dev_attr_result);
+ device_unregister(&tdev);
+ }
+ return err;
+}
+module_init(test_init);
+
+static void test_exit(void)
+{
+ device_remove_file(&tdev, &dev_attr_result);
+ device_remove_file(&tdev, &dev_attr_fwnum);
+
+ device_unregister(&tdev);
+ pr_info(TCID ": module exited\n");
+}
+module_exit(test_exit);
diff --git a/testcases/kernel/firmware/fw_load_user/.gitignore b/testcases/kernel/firmware/fw_load_user/.gitignore
new file mode 100644
index 0000000..1d08149
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_user/.gitignore
@@ -0,0 +1 @@
+/fw_load
diff --git a/testcases/kernel/firmware/fw_load_user/Makefile b/testcases/kernel/firmware/fw_load_user/Makefile
new file mode 100644
index 0000000..effd5da
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_user/Makefile
@@ -0,0 +1,20 @@
+# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+#
+# 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 would 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 the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/firmware/fw_load_user/README b/testcases/kernel/firmware/fw_load_user/README
new file mode 100644
index 0000000..702fac9
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_user/README
@@ -0,0 +1,11 @@
+The aim of the test is to check device firmware loading. Since kernel 3.7
+firmware loading changed to direct loading (by-pass udev). The test consists
+of the two parts:
+ - userspace part
+ - kernelspace part
+
+This is the userspace part, its tasks are:
+ - create firmware files in the standard firmware paths
+ - load the module and initiate firmware request procedure
+ - read device's result file and print final results
+ - unload the module.
diff --git a/testcases/kernel/firmware/fw_load_user/fw_load.c b/testcases/kernel/firmware/fw_load_user/fw_load.c
new file mode 100644
index 0000000..880531e
--- /dev/null
+++ b/testcases/kernel/firmware/fw_load_user/fw_load.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * 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 would 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 the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Alexey Kodanev <alexey.kodanev@oracle.com>
+ *
+ * Test checks device firmware loading.
+ */
+
+#define _GNU_SOURCE
+#include <sys/utsname.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+#include "tst_module.h"
+
+/* number of test firmware files */
+#define FW_FILES 5
+
+char *TCID = "fw_load";
+int TST_TOTAL = FW_FILES;
+
+static int fw_size = 0x1000;
+
+static const char fw_name[] = "load_tst.fw";
+static const char module_name[] = "ltp_fw_load.ko";
+
+/* paths to module's sysfs files */
+static const char dev_fwnum[] = "/sys/devices/ltp_fw_load/fwnum";
+static const char dev_result[] = "/sys/devices/ltp_fw_load/result";
+
+struct fw_file_info {
+ char *file;
+ char *dir;
+ int fake;
+ int remove_dir;
+ int remove_file;
+};
+
+static struct fw_file_info fw[FW_FILES];
+static int fw_num;
+
+/* test options */
+static char *narg;
+static int nflag;
+static int skip_cleanup;
+static int verbose;
+static const option_t options[] = {
+ {"n:", &nflag, &narg},
+ {"s", &skip_cleanup, NULL},
+ {"v", &verbose, NULL},
+ {NULL, NULL, NULL}
+};
+
+static void help(void);
+static void setup(int argc, char *argv[]);
+static void test_run(void);
+static void cleanup(void);
+
+/*
+ * create firmware files in the fw_paths
+ * @fw_paths: it must be termintated by a NULL pointer
+ */
+static void create_firmware(char *const fw_paths[]);
+
+int main(int argc, char *argv[])
+{
+ setup(argc, argv);
+
+ test_run();
+
+ cleanup();
+
+ tst_exit();
+}
+
+static void help(void)
+{
+ printf(" -n x Write x bytes to firmware file, default is %d\n",
+ fw_size);
+ printf(" -s Skip cleanup\n");
+ printf(" -v Verbose\n");
+}
+
+void setup(int argc, char *argv[])
+{
+ char *msg;
+ msg = parse_opts(argc, argv, options, help);
+ if (msg != NULL)
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+ if (nflag) {
+ if (sscanf(narg, "%i", &fw_size) != 1)
+ tst_brkm(TBROK, NULL, "-n option arg is not a number");
+ if (fw_size < 0)
+ tst_brkm(TBROK, NULL, "-n option arg is less than 0");
+ }
+
+ tst_require_root(NULL);
+
+ if (tst_kvercmp(3, 7, 0) < 0) {
+ tst_brkm(TCONF, NULL,
+ "Test must be run with kernel 3.7 or newer");
+ }
+
+ char fw_size_param[19];
+ snprintf(fw_size_param, 19, "fw_size=%d", fw_size);
+ char *const mod_params[2] = { fw_size_param, NULL };
+ tst_module_load(NULL, module_name, mod_params);
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* get current Linux version and make firmware paths */
+ struct utsname uts_name;
+ uname(&uts_name);
+
+ /* 4 firmware paths + NULL */
+ char *fw_paths[5] = { "/lib/firmware", "/lib/firmware/updates" };
+ SAFE_ASPRINTF(cleanup, &fw_paths[2], "%s/%s", fw_paths[0], uts_name.release);
+ SAFE_ASPRINTF(cleanup, &fw_paths[3], "%s/%s", fw_paths[1], uts_name.release);
+
+ /* create firmware in the hard coded firmware search paths */
+ create_firmware(fw_paths);
+
+ free(fw_paths[2]);
+ free(fw_paths[3]);
+
+ /* make non-existent firmware file */
+ SAFE_ASPRINTF(cleanup, &fw[fw_num].file, "/n%d_%s", fw_num, fw_name);
+ fw[fw_num].fake = 1;
+ ++fw_num;
+}
+
+static void test_run(void)
+{
+ /* initiate firmware requests */
+ SAFE_FILE_PRINTF(cleanup, dev_fwnum, "%d", fw_num);
+
+ /* get module results by reading result bit mask */
+ int result = 0;
+ SAFE_FILE_SCANF(cleanup, dev_result, "%d", &result);
+
+ int i, fail, offset;
+ for (i = 0; i < fw_num; ++i) {
+ fail = (result & (1 << i)) == 0 && !fw[i].fake;
+ offset = (fw[i].dir) ? strlen(fw[i].dir) : 0;
+ tst_resm((fail) ? TFAIL : TPASS,
+ "Expect: %s load firmware '...%s'",
+ (fw[i].fake) ? "can't" : "can",
+ fw[i].file + offset);
+ }
+}
+
+static void cleanup(void)
+{
+ if (skip_cleanup)
+ return;
+
+ int i;
+ /* remove subdirs first and then upper level dirs */
+ for (i = fw_num - 1; i >= 0; --i) {
+ if (fw[i].remove_file && remove(fw[i].file) == -1)
+ tst_resm(TWARN, "Can't remove: %s", fw[i].file);
+ free(fw[i].file);
+
+ if (fw[i].remove_dir && remove(fw[i].dir) == -1)
+ tst_resm(TWARN, "Can't remove %s", fw[i].dir);
+ free(fw[i].dir);
+ }
+
+ tst_module_unload(NULL, module_name);
+
+ TEST_CLEANUP;
+}
+
+static void create_firmware(char *const fw_paths[])
+{
+ int i = 0;
+ while (fw_paths[i] != NULL) {
+ struct fw_file_info *fi = &fw[fw_num];
+ fi->dir = strdup(fw_paths[i]);
+ if (access(fi->dir, X_OK) == -1) {
+ /* create dir */
+ SAFE_MKDIR(cleanup, fi->dir, 0755);
+ fi->remove_dir = 1;
+ }
+
+ /* create test firmware file */
+ SAFE_ASPRINTF(cleanup, &fi->file, "%s/n%d_%s", fi->dir, fw_num, fw_name);
+
+ FILE *f = SAFE_FOPEN(cleanup, fi->file, "w");
+ fi->remove_file = 1;
+ int k, byte = fw_num;
+ ++fw_num;
+ for (k = 0; k < fw_size; ++k)
+ fputc(byte, f);
+ SAFE_FCLOSE(cleanup, f);
+ ++i;
+ }
+}
diff --git a/testcases/kernel/mem/vma/vma01.c b/testcases/kernel/mem/vma/vma01.c
index 7cd22c0..396a174 100644
--- a/testcases/kernel/mem/vma/vma01.c
+++ b/testcases/kernel/mem/vma/vma01.c
@@ -192,7 +192,13 @@
tst_resm(TPASS, "two 3*ps VMAs found.");
break;
case 1:
- tst_resm(TFAIL, "A single 6*ps VMA found.");
+ if (tst_kvercmp(3, 0, 0) < 0) {
+ tst_resm(TCONF, "A single 6*ps VMA found. You may need"
+ " to back port kernel commit 965f55d "
+ "to fix this scalability issue.");
+ } else {
+ tst_resm(TFAIL, "A single 6*ps VMA found.");
+ }
break;
default:
tst_brkm(TBROK, cleanup, "unexpected VMA found.");
diff --git a/testcases/kernel/syscalls/.gitignore b/testcases/kernel/syscalls/.gitignore
index 18d03d4..9a8c14c 100644
--- a/testcases/kernel/syscalls/.gitignore
+++ b/testcases/kernel/syscalls/.gitignore
@@ -522,6 +522,8 @@
/mount/mount02
/mount/mount03
/mount/mount04
+/mount/mount05
+/mount/mount06
/mount/setuid_test
/move_pages/move_pages01
/move_pages/move_pages02
diff --git a/testcases/kernel/syscalls/flock/flock03.c b/testcases/kernel/syscalls/flock/flock03.c
index bacf4f6..a7a1cd9 100644
--- a/testcases/kernel/syscalls/flock/flock03.c
+++ b/testcases/kernel/syscalls/flock/flock03.c
@@ -86,13 +86,13 @@
"file, errno %d", errno);
pid = FORK_OR_VFORK();
-
+
if (pid == -1)
tst_brkm(TFAIL, cleanup, "fork() failed, errno %d",
errno);
if (pid == 0) {
#ifdef UCLINUX
- if (self_exec(argv[0], "ds", fd, FILENAME) < 0)
+ if (self_exec(argv[0], "ds", fd, FILE_NAME) < 0)
tst_brkm(TFAIL, cleanup, "self_exec failed, "
"errno &d", errno);
#else
@@ -161,7 +161,7 @@
}
TEST(flock(fd2, LOCK_EX | LOCK_NB));
-
+
if (TEST_RETURN == -1) {
fprintf(stderr, "CHILD: Unable to lock file after "
"unlocking: %s\n", strerror(TEST_ERRNO));
@@ -169,10 +169,10 @@
} else {
fprintf(stderr, "CHILD: Locking after unlock passed\n");
}
-
+
close(fd);
close(fd2);
-
+
exit(0);
}
diff --git a/testcases/kernel/syscalls/inotify/inotify03.c b/testcases/kernel/syscalls/inotify/inotify03.c
index f4c8194..f17004f 100644
--- a/testcases/kernel/syscalls/inotify/inotify03.c
+++ b/testcases/kernel/syscalls/inotify/inotify03.c
@@ -51,21 +51,21 @@
#include "linux_syscall_numbers.h"
#include "inotify.h"
+char *TCID = "inotify03";
+int TST_TOTAL = 3;
+
#if defined(HAVE_SYS_INOTIFY_H)
#include <sys/inotify.h>
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
-#define EVENT_SIZE (sizeof (struct inotify_event))
+#define EVENT_SIZE (sizeof(struct inotify_event))
/* reasonable guess as to size of 1024 events */
#define EVENT_BUF_LEN (EVENT_MAX * (EVENT_SIZE + 16))
-void help(void);
-void setup();
-void cleanup();
-
-char *TCID = "inotify03";
-int TST_TOTAL = 3;
+static void help(void);
+static void setup(void);
+static void cleanup(void);
#define BUF_SIZE 1024
char fname[BUF_SIZE];
@@ -77,54 +77,35 @@
char event_buf[EVENT_BUF_LEN];
-#define DEFAULT_FSTYPE "ext2"
-#define DIR_MODE S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP
+#define DIR_MODE (S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP)
-static char *Fstype;
static char mntpoint[20];
-static int mount_flag = 0;
-static char *fstype;
+static int mount_flag;
+static char *fstype = "ext2";
static char *device;
-static int Tflag = 0;
-static int Dflag = 0;
+static int dflag;
-static option_t options[] = { /* options supported by mount01 test */
- {"T:", &Tflag, &fstype}, /* -T type of filesystem */
- {"D:", &Dflag, &device}, /* -D device used for mounting */
+static option_t options[] = {
+ {"T:", NULL, &fstype},
+ {"D:", &dflag, &device},
{NULL, NULL, NULL}
};
-int main(int ac, char **av)
+int main(int argc, char *argv[])
{
char *msg;
int ret;
int len, i, test_num;
- if ((msg = parse_opts(ac, av, options, &help)) != NULL)
+ msg = parse_opts(argc, argv, options, &help);
+ if (msg != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
/* Check for mandatory option of the testcase */
- if (!Dflag) {
+ if (!dflag)
tst_brkm(TBROK, NULL, "You must specifiy the device used for "
" mounting with -D option, Run '%s -h' for option "
" information.", TCID);
- }
-
- if (Tflag) {
- Fstype = (char *)malloc(strlen(fstype) + 1);
- if (Fstype == NULL) {
- tst_brkm(TBROK, NULL, "malloc - failed to alloc %zu"
- "errno %d", strlen(fstype), errno);
- }
- strncpy(Fstype, fstype, strlen(fstype) + 1);
- } else {
- Fstype = (char *)malloc(strlen(DEFAULT_FSTYPE) + 1);
- if (Fstype == NULL) {
- tst_brkm(TBROK, NULL, "malloc - failed to alloc %zu"
- "errno %d", strlen(DEFAULT_FSTYPE), errno);
- }
- strncpy(Fstype, DEFAULT_FSTYPE, strlen(DEFAULT_FSTYPE) + 1);
- }
setup();
@@ -206,10 +187,7 @@
tst_exit();
}
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup()
+static void setup(void)
{
int ret;
@@ -227,8 +205,8 @@
}
/* Call mount(2) */
- tst_resm(TINFO, "mount %s to %s fstype=%s", device, mntpoint, Fstype);
- TEST(mount(device, mntpoint, Fstype, 0, NULL));
+ tst_resm(TINFO, "mount %s to %s fstype=%s", device, mntpoint, fstype);
+ TEST(mount(device, mntpoint, fstype, 0, NULL));
/* check return code */
if (TEST_RETURN != 0) {
@@ -251,75 +229,54 @@
}
/* close the file we have open */
- if (close(fd) == -1) {
+ if (close(fd) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "close(%s) failed", fname);
- }
fd_notify = myinotify_init();
if (fd_notify < 0) {
- if (errno == ENOSYS) {
+ if (errno == ENOSYS)
tst_brkm(TCONF, cleanup,
"inotify is not configured in this kernel.");
- } else {
+ else
tst_brkm(TBROK | TERRNO, cleanup,
"inotify_init failed");
- }
}
wd = myinotify_add_watch(fd_notify, fname, IN_ALL_EVENTS);
- if (wd < 0) {
+ if (wd < 0)
tst_brkm(TBROK | TERRNO, cleanup,
"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed.",
fd_notify, fname);
- };
-
}
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- */
-void cleanup()
+static void cleanup(void)
{
- free(Fstype);
- if (close(fd_notify) == -1) {
+ if (close(fd_notify) == -1)
tst_resm(TWARN | TERRNO, "close(%d) failed", fd_notify);
- }
if (mount_flag) {
TEST(umount(mntpoint));
- if (TEST_RETURN != 0) {
+ if (TEST_RETURN != 0)
tst_resm(TWARN | TTERRNO, "umount(%s) failed",
mntpoint);
- }
}
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
TEST_CLEANUP;
tst_rmdir();
}
-/*
- * issue a help message
- */
-void help()
+static void help(void)
{
printf("-T type : specifies the type of filesystem to be mounted."
- " Default ext2. \n");
- printf("-D device : device used for mounting \n");
+ " Default ext2.\n");
+ printf("-D device : device used for mounting.\n");
}
#else
-char *TCID = "inotify03";
-int TST_TOTAL = 0;
-
-int main()
+int main(void)
{
tst_brkm(TCONF, NULL, "system doesn't have required inotify support");
}
diff --git a/testcases/kernel/syscalls/inotify/inotify04.c b/testcases/kernel/syscalls/inotify/inotify04.c
index df91acb..9423397 100644
--- a/testcases/kernel/syscalls/inotify/inotify04.c
+++ b/testcases/kernel/syscalls/inotify/inotify04.c
@@ -79,6 +79,11 @@
int fd_notify, reap_wd_file, reap_wd_dir, wd_dir, wd_file;
+static struct tst_kern_exv kvers[] = {
+ { "RHEL5", "2.6.18-132" },
+ { NULL, NULL },
+};
+
static void cleanup(void)
{
@@ -172,7 +177,7 @@
* This isn't well documented in inotify(7), but it's intuitive if you
* understand how Unix works.
*/
- if (0 <= tst_kvercmp(2, 6, 25)) {
+ if (tst_kvercmp2(2, 6, 25, kvers) >= 0) {
event_set[tst_count].mask = IN_ATTRIB;
strcpy(event_set[tst_count].name, "");
tst_count++;
diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c
index b1aa71f..d3f0733 100644
--- a/testcases/kernel/syscalls/mount/mount03.c
+++ b/testcases/kernel/syscalls/mount/mount03.c
@@ -16,15 +16,7 @@
*/
/*
- * EXECUTED BY : root / superuser
- *
- * TEST TITLE : Test for checking mount(2) flags
- *
- * TEST CASE TOTAL : 6
- *
- * AUTHOR : Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
- *
- * DESCRIPTION
+ * DESCRIPTION
* Check for basic mount(2) system call flags.
*
* Verify that mount(2) syscall passes for each flag setting and validate
@@ -35,30 +27,8 @@
* 4) MS_SYNCHRONOUS - writes are synced at once.
* 5) MS_REMOUNT - alter flags of a mounted FS.
* 6) MS_NOSUID - ignore suid and sgid bits.
- *
- * Setup:
- * Setup signal handling.
- * Create a mount point.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute mount system call for each flag
- * Validate each flag setting. if validation fails
- * Delete the mount point.
- * Log the errno and Issue a FAIL message.
- * Delete the mount point.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Delete the temporary directory(s)/file(s) created.
- *
- * RESTRICTIONS
- * test must run with the -D option
- * test doesn't support -c option to run it in parallel, as mount
- * syscall is not supposed to run in parallel.
- *****************************************************************************/
+ * 7) MS_NOATIME - do not update access times.
+ */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
@@ -73,17 +43,18 @@
#include <fcntl.h>
#include <pwd.h>
#include <unistd.h>
+
#include "test.h"
#include "usctest.h"
+#include "safe_macros.h"
static void help(void);
static void setup(void);
static void cleanup(void);
static int test_rwflag(int, int);
-static int setup_uid(void);
char *TCID = "mount03";
-int TST_TOTAL = 6;
+int TST_TOTAL = 7;
#define DEFAULT_FSTYPE "ext2"
#define TEMP_FILE "temp_file"
@@ -92,9 +63,9 @@
S_IXGRP|S_IROTH|S_IXOTH)
#define SUID_MODE (S_ISUID|S_IRUSR|S_IXUSR|S_IXGRP|S_IXOTH)
-static char *fs_type;
+static const char *fs_type = "ext2";
-static char mntpoint[20];
+static const char mntpoint[] = "mntpoint";
static char *fstype;
static char *device;
static int tflag;
@@ -104,9 +75,7 @@
static char write_buffer[BUFSIZ];
static char read_buffer[BUFSIZ];
static char path_name[PATH_MAX];
-static char testhome_path[PATH_MAX];
static char file[PATH_MAX];
-static char *cmd = "cp";
long rwflags[] = {
MS_RDONLY,
@@ -115,6 +84,7 @@
MS_SYNCHRONOUS,
MS_RDONLY,
MS_NOSUID,
+ MS_NOATIME,
};
static option_t options[] = {
@@ -138,21 +108,9 @@
"you must specify the device used for mounting with -D "
"option");
- if (tflag) {
- fs_type = malloc(strlen(fstype) + 1);
- if (fs_type == NULL)
- tst_brkm(TBROK | TERRNO, NULL, "malloc failed");
+ if (tflag)
+ fs_type = fstype;
- fs_type[strlen(fstype)] = '\0';
- strncpy(fs_type, fstype, strlen(fstype));
- } else {
- fs_type = malloc(strlen(DEFAULT_FSTYPE) + 1);
- if (fs_type == NULL)
- tst_brkm(TBROK | TERRNO, NULL, "malloc failed");
-
- strncpy(fs_type, DEFAULT_FSTYPE, strlen(DEFAULT_FSTYPE));
- fs_type[strlen(DEFAULT_FSTYPE)] = '\0';
- }
if (STD_COPIES != 1) {
tst_resm(TINFO, "-c option has no effect for this testcase - "
@@ -169,11 +127,9 @@
for (i = 0; i < TST_TOTAL; ++i) {
- /* Call mount(2) */
TEST(mount(device, mntpoint, fs_type, rwflags[i],
NULL));
- /* check return code */
if (TEST_RETURN != 0) {
tst_resm(TFAIL | TTERRNO, "mount(2) failed");
continue;
@@ -203,12 +159,13 @@
* test_rwflag(int i, int cnt)
* Validate the mount system call for rwflags.
*/
-
int test_rwflag(int i, int cnt)
{
int ret, fd, pid, status;
char nobody_uid[] = "nobody";
+ time_t atime;
struct passwd *ltpuser;
+ struct stat file_stat;
switch (i) {
case 0:
@@ -337,21 +294,23 @@
case 5:
/* Validate MS_NOSUID flag of mount call */
- if (setup_uid() != 0) {
- tst_resm(TBROK | TERRNO, "setup_uid failed");
- return 1;
- }
+ snprintf(file, PATH_MAX, "%ssetuid_test", path_name);
+ SAFE_FILE_PRINTF(cleanup, file, "TEST FILE");
+
+ if (stat(file, &file_stat) < 0)
+ tst_brkm(TBROK, cleanup, "stat for setuid_test failed");
+
+ if (file_stat.st_mode != SUID_MODE &&
+ chmod(file, SUID_MODE) < 0)
+ tst_brkm(TBROK, cleanup,
+ "setuid for setuid_test failed");
+
pid = fork();
switch (pid) {
case -1:
tst_resm(TBROK | TERRNO, "fork failed");
return 1;
case 0:
- snprintf(file, PATH_MAX, "%ssetuid_test", path_name);
- if (chmod(file, SUID_MODE) != 0)
- tst_resm(TWARN, "chmod(%s, %#o) failed",
- file, SUID_MODE);
-
ltpuser = getpwnam(nobody_uid);
if (setreuid(ltpuser->pw_uid, ltpuser->pw_uid) == -1)
tst_resm(TWARN | TERRNO,
@@ -370,72 +329,62 @@
return 1;
}
}
+ case 6:
+ /* Validate MS_NOATIME flag of mount call */
+
+ snprintf(file, PATH_MAX, "%satime", path_name);
+ fd = open(file, O_CREAT | O_RDWR, S_IRWXU);
+ if (fd == -1) {
+ tst_resm(TWARN | TERRNO, "opening %s failed", file);
+ return 1;
+ }
+
+ if (write(fd, "TEST_MS_NOATIME", 15) != 15) {
+ tst_resm(TWARN | TERRNO, "write %s failed", file);
+ return 1;
+ }
+
+ if (fstat(fd, &file_stat) == -1) {
+ tst_resm(TWARN | TERRNO, "stat %s failed #1", file);
+ return 1;
+ }
+
+ atime = file_stat.st_atime;
+
+ sleep(1);
+
+ if (read(fd, NULL, 20) == -1) {
+ tst_resm(TWARN | TERRNO, "read %s failed", file);
+ return 1;
+ }
+
+ if (fstat(fd, &file_stat) == -1) {
+ tst_resm(TWARN | TERRNO, "stat %s failed #2", file);
+ return 1;
+ }
+ close(fd);
+
+ if (file_stat.st_atime != atime) {
+ tst_resm(TWARN, "access time is updated");
+ return 1;
+ }
+ return 0;
}
return 0;
}
-/* setup_uid() - performs setup for NOUID test */
-int setup_uid()
+void setup(void)
{
- int pid, status;
- char command[PATH_MAX];
-
- pid = fork();
- switch (pid) {
- case -1:
- tst_resm(TWARN | TERRNO, "fork failed");
- return 1;
- case 0:
- /* Put command into string */
- sprintf(command, "%s %s %s", cmd, testhome_path, path_name);
-
- /* Run command to cp file to right spot */
- if (system(command) == 0)
- execlp(file, basename(file), NULL);
- else
- printf("call to %s failed\n", command);
-
- exit(1);
- default:
- waitpid(pid, &status, 0);
- if (WIFEXITED(status)) {
- return WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- return WTERMSIG(status);
- } else {
- /* Should be 0. */
- assert(status == 0);
- return 0;
- }
- }
-}
-
-void setup()
-{
- int fd;
char path[PATH_MAX];
- char *test_home;
- struct stat setuid_test_stat;
tst_sig(FORK, DEF_HANDLER, cleanup);
- /* Check whether we are root */
- if (geteuid() != 0) {
- free(fs_type);
- tst_brkm(TBROK, NULL, "Test must be run as root");
- }
+ tst_require_root(NULL);
tst_tmpdir();
- test_home = get_current_dir_name();
+ SAFE_MKDIR(cleanup, mntpoint, DIR_MODE);
- sprintf(mntpoint, "mnt_%d", getpid());
-
- if (mkdir(mntpoint, DIR_MODE))
- tst_brkm(TBROK | TERRNO, cleanup, "mkdir(%s, %#o) failed",
- mntpoint, DIR_MODE);
-
- /* Get the current working directory of the process */
if (getcwd(path_name, sizeof(path_name)) == NULL)
tst_brkm(TBROK, cleanup, "getcwd failed");
@@ -443,53 +392,22 @@
tst_brkm(TBROK, cleanup, "chmod(%s, %#o) failed",
path_name, DIR_MODE);
- snprintf(file, PATH_MAX, "%s/setuid_test", path_name);
- fd = open(file, O_CREAT | O_TRUNC, S_IRWXU);
- if (fd == -1)
- tst_brkm(TBROK, cleanup, "open file failed");
- close(fd);
-
- if (stat(file, &setuid_test_stat) < 0) {
- tst_brkm(TBROK, cleanup, "stat for setuid_test failed");
- } else {
- if ((setuid_test_stat.st_uid || setuid_test_stat.st_gid) &&
- chown(file, 0, 0) < 0)
- tst_brkm(TBROK, cleanup,
- "chown for setuid_test failed");
-
- if (setuid_test_stat.st_mode != SUID_MODE &&
- chmod(file, SUID_MODE) < 0)
- tst_brkm(TBROK, cleanup,
- "setuid for setuid_test failed");
- }
-
- /*
- * under temporary directory
- */
strncpy(path, path_name, PATH_MAX);
snprintf(path_name, PATH_MAX, "%s/%s/", path, mntpoint);
- strcpy(testhome_path, test_home);
- strcat(testhome_path, "/setuid_test");
TEST_PAUSE;
-
}
-void cleanup()
+void cleanup(void)
{
- free(fs_type);
-
TEST_CLEANUP;
tst_rmdir();
}
-/*
- * issue a help message
- */
-void help()
+void help(void)
{
- printf("-T type : specifies the type of filesystem to be mounted."
- " Default ext2.\n");
+ printf("-T type : specifies the type of filesystem to be mounted. "
+ "Default ext2.\n");
printf("-D device : device used for mounting.\n");
}
diff --git a/testcases/kernel/syscalls/mount/mount05.c b/testcases/kernel/syscalls/mount/mount05.c
new file mode 100644
index 0000000..65cc0ab
--- /dev/null
+++ b/testcases/kernel/syscalls/mount/mount05.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013 Fujitsu Ltd.
+ * Author: DAN LI <li.dan@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+/*
+ * DESCRIPTION
+ * Test for feature MS_BIND of mount.
+ * "Perform a bind mount, making a file or a directory subtree visible
+ * at another point within a file system."
+ */
+
+#include <errno.h>
+#include <sys/mount.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+
+static void help(void);
+static void setup(void);
+static void cleanup(void);
+
+char *TCID = "mount05";
+int TST_TOTAL = 1;
+
+#define DIR_MODE (S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP)
+
+static const char *fs_type = "ext2";
+
+static int tflag;
+static int dflag;
+static char *fstype;
+static char *device;
+static const char file_src[] = "mnt_src/tstfile";
+static const char file_des[] = "mnt_des/tstfile";
+static const char mntpoint_src[] = "mnt_src";
+static const char mntpoint_des[] = "mnt_des";
+
+static option_t options[] = {
+ {"T:", &tflag, &fstype},
+ {"D:", &dflag, &device},
+ {NULL, NULL, NULL},
+};
+
+int main(int argc, char *argv[])
+{
+ int lc;
+ char *msg;
+
+ msg = parse_opts(argc, argv, options, &help);
+ if (msg != NULL)
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+ if (tflag)
+ fs_type = fstype;
+
+ if (STD_COPIES != 1) {
+ tst_resm(TINFO, "-c option has no effect for this testcase - "
+ "%s doesn't allow running more than one instance "
+ "at a time", TCID);
+ STD_COPIES = 1;
+ }
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(mount(mntpoint_src, mntpoint_des, fs_type, MS_BIND, NULL));
+
+ if (TEST_RETURN != 0) {
+ tst_resm(TFAIL | TTERRNO, "mount(2) failed");
+ } else {
+
+ if (open(file_des, O_CREAT | O_EXCL, S_IRWXU) == -1 &&
+ errno == EEXIST)
+ tst_resm(TPASS, "bind mount is ok");
+ else
+ tst_resm(TFAIL, "file %s is not available",
+ file_des);
+
+ TEST(umount(mntpoint_des));
+ if (TEST_RETURN != 0)
+ tst_brkm(TBROK | TTERRNO, cleanup,
+ "umount(2) failed");
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
+}
+
+void setup(void)
+{
+ tst_require_root(NULL);
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_tmpdir();
+
+ SAFE_MKDIR(cleanup, mntpoint_src, DIR_MODE);
+ SAFE_MKDIR(cleanup, mntpoint_des, DIR_MODE);
+
+ if (dflag && tflag)
+ if (mount(device, mntpoint_src, fs_type, 0, NULL) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "mount failed");
+
+ SAFE_FILE_PRINTF(cleanup, file_src, "TEST FILE");
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+ if (dflag && tflag)
+ if (umount(mntpoint_src) != 0)
+ tst_brkm(TBROK | TTERRNO, NULL, "umount(2) failed");
+
+ TEST_CLEANUP;
+
+ tst_rmdir();
+}
+
+void help(void)
+{
+ printf("-T type : specifies the type of filesystem to be mounted. "
+ "Default ext2.\n");
+ printf("-D device : device used for mounting.\n");
+}
diff --git a/testcases/kernel/syscalls/mount/mount06.c b/testcases/kernel/syscalls/mount/mount06.c
new file mode 100644
index 0000000..acfb22d
--- /dev/null
+++ b/testcases/kernel/syscalls/mount/mount06.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2013 Fujitsu Ltd.
+ * Author: DAN LI <li.dan@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+/*
+ * DESCRIPTION
+ * Test for feature MS_MOVE of mount(2).
+ * "Move an existing mount point to the new location."
+ */
+
+#include <errno.h>
+#include <sys/mount.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+
+#define MNTPOINT_SRC "mnt_src"
+#define MNTPOINT_DES "mnt_des"
+#define LINELENGTH 256
+#define DIR_MODE (S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP)
+
+static int ismount(char *mntpoint);
+static void setup(void);
+static void cleanup(void);
+static void help(void);
+
+char *TCID = "mount06";
+int TST_TOTAL = 1;
+
+static char *fstype = "ext2";
+
+static int dflag;
+static char *device;
+static char path_name[PATH_MAX];
+static char mntpoint_src[PATH_MAX];
+static char mntpoint_des[PATH_MAX];
+
+static option_t options[] = {
+ {"T:", NULL, &fstype},
+ {"D:", &dflag, &device},
+ {NULL, NULL, NULL},
+};
+
+int main(int argc, char *argv[])
+{
+ int lc;
+ char *msg;
+
+ msg = parse_opts(argc, argv, options, &help);
+ if (msg != NULL)
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+ /* Check for mandatory option of the testcase */
+ if (!dflag)
+ tst_brkm(TBROK, NULL,
+ "you must specify the device used for mounting with "
+ "the -D option");
+
+ if (STD_COPIES != 1) {
+ tst_resm(TINFO, "-c option has no effect for this testcase - "
+ "%s doesn't allow running more than one instance "
+ "at a time", TCID);
+ STD_COPIES = 1;
+ }
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ if (mount(device, mntpoint_src, fstype, 0, NULL) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "mount %s failed",
+ mntpoint_src);
+
+ TEST(mount(mntpoint_src, mntpoint_des, fstype, MS_MOVE, NULL));
+
+ if (TEST_RETURN != 0) {
+ tst_resm(TFAIL | TTERRNO, "mount(2) failed");
+ } else {
+
+ if (!ismount(mntpoint_src) && ismount(mntpoint_des))
+ tst_resm(TPASS, "move mount is ok");
+ else
+ tst_resm(TFAIL, "move mount does not work");
+
+ TEST(umount(mntpoint_des));
+ if (TEST_RETURN != 0)
+ tst_brkm(TBROK | TTERRNO, cleanup,
+ "umount(2) failed");
+ }
+ }
+ cleanup();
+
+ tst_exit();
+}
+
+int ismount(char *mntpoint)
+{
+ int ret = 0;
+ FILE *file;
+ char line[LINELENGTH];
+
+ file = fopen("/proc/mounts", "r");
+ if (file == NULL)
+ tst_brkm(TFAIL | TERRNO, NULL, "Open /proc/mounts failed");
+
+ while (fgets(line, LINELENGTH, file) != NULL) {
+ if (strstr(line, mntpoint) != NULL) {
+ ret = 1;
+ break;
+ }
+ }
+ fclose(file);
+ return ret;
+}
+
+void setup(void)
+{
+ tst_require_root(NULL);
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_tmpdir();
+
+ if (getcwd(path_name, sizeof(path_name)) == NULL)
+ tst_brkm(TBROK, cleanup, "getcwd failed");
+
+ /*
+ * Turn current dir into a private mount point being a parent
+ * mount which is required by move mount.
+ */
+ if (mount(path_name, path_name, "none", MS_BIND, NULL) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "bind mount failed");
+
+ if (mount("none", path_name, "none", MS_PRIVATE, NULL) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "mount private failed");
+
+ snprintf(mntpoint_src, PATH_MAX, "%s/%s", path_name, MNTPOINT_SRC);
+ snprintf(mntpoint_des, PATH_MAX, "%s/%s", path_name, MNTPOINT_DES);
+
+ SAFE_MKDIR(cleanup, mntpoint_src, DIR_MODE);
+ SAFE_MKDIR(cleanup, mntpoint_des, DIR_MODE);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+ if (umount(path_name) != 0)
+ tst_brkm(TBROK | TERRNO, NULL, "umount(2) %s failed",
+ path_name);
+
+ TEST_CLEANUP;
+
+ tst_rmdir();
+}
+
+void help(void)
+{
+ printf("-T type : specifies the type of filesystem to be mounted. "
+ "Default ext2.\n");
+ printf("-D device : device used for mounting.\n");
+}
diff --git a/testcases/kernel/syscalls/syslog/syslog-lib.sh b/testcases/kernel/syscalls/syslog/syslog-lib.sh
index c912d61..0885805 100755
--- a/testcases/kernel/syscalls/syslog/syslog-lib.sh
+++ b/testcases/kernel/syscalls/syslog/syslog-lib.sh
@@ -29,16 +29,6 @@
# rsyslogd .conf specific args.
RSYSLOG_CONFIG=
-# Command to restart syslog daemon.
-SYSLOG_RESTART_COMMAND=
-
-# running under systemd?
-if command -v systemctl >/dev/null 2>&1; then
- HAVE_SYSTEMCTL=1
-else
- HAVE_SYSTEMCTL=0
-fi
-
# number of seconds to wait for another syslog test to complete
WAIT_COUNT=60
@@ -75,43 +65,15 @@
tst_resm TBROK "Testing is terminating due to a signal"
cleanup 1' $TRAP_SIGS || exit 1
- # Check to see if syslogd or syslog-ng exists
- if [ -e /sbin/syslogd ]; then
+ if [ "$SYSLOG_DAEMON" == "syslog" ]; then
CONFIG_FILE="/etc/syslog.conf"
- SYSLOG_INIT_SCRIPT="/etc/init.d/sysklogd"
- elif command -v syslog-ng >/dev/null 2>&1; then
+ elif [ "$SYSLOG_DAEMON" == "syslog-ng" ]; then
CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
- SYSLOG_INIT_SCRIPT="/etc/init.d/syslog-ng"
- elif command -v rsyslogd >/dev/null 2>&1; then
+ elif [ "$SYSLOG_DAEMON" == "rsyslog" ]; then
CONFIG_FILE="/etc/rsyslog.conf"
- SYSLOG_INIT_SCRIPT="/etc/init.d/rsyslog"
RSYSLOG_CONFIG='$ModLoad imuxsock.so'
else
- tst_resm TCONF "couldn't find syslogd, syslog-ng, or rsyslogd"
- cleanup 0
- fi
-
- SVCNAME=$(basename $SYSLOG_INIT_SCRIPT)
- if [ $HAVE_SYSTEMCTL == 1 ]; then
- for svc in "$SVCNAME" "syslog"; do
- if systemctl is-enabled $svc.service >/dev/null 2>&1; then
- SYSLOG_RESTART_COMMAND="systemctl restart $svc.service"
- break
- fi
- done
- else
- # Fallback to /etc/init.d/syslog if $SYSLOG_INIT_SCRIPT
- # doesn't exist.
- for SYSLOG_INIT_SCRIPT in "$SYSLOG_INIT_SCRIPT" "/etc/init.d/syslog"; do
- if [ -x "$SYSLOG_INIT_SCRIPT" ]; then
- SYSLOG_RESTART_COMMAND="$SYSLOG_INIT_SCRIPT restart"
- break
- fi
- done
- fi
-
- if [ -z "$SYSLOG_RESTART_COMMAND" ]; then
- tst_resm TBROK "Don't know how to restart $SVCNAME"
+ tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
cleanup 1
fi
@@ -152,15 +114,18 @@
cleanup_command=$1
fi
- tst_resm TINFO "restarting syslog daemon via $SYSLOG_RESTART_COMMAND"
+ tst_resm TINFO "restarting syslog daemon"
- if $SYSLOG_RESTART_COMMAND >/dev/null 2>&1; then
- # XXX: this really shouldn't exist; if *syslogd isn't ready
- # once the restart directive has been issued, then it needs to
- # be fixed.
- sleep 2
- else
- $cleanup_command
+ if [ -n "$SYSLOG_DAEMON" ]; then
+ restart_daemon $SYSLOG_DAEMON
+ if [ $? -eq 0 ]; then
+ # XXX: this really shouldn't exist; if *syslogd isn't
+ # ready once the restart directive has been issued,
+ # then it needs to be fixed.
+ sleep 2
+ else
+ $cleanup_command
+ fi
fi
}
diff --git a/testcases/kernel/timers/clock_settime/clock_settime03.c b/testcases/kernel/timers/clock_settime/clock_settime03.c
index a949303..0b24e6d 100644
--- a/testcases/kernel/timers/clock_settime/clock_settime03.c
+++ b/testcases/kernel/timers/clock_settime/clock_settime03.c
@@ -49,8 +49,8 @@
EINVAL, /* Invalid timespec */
EINVAL, /* NSEC_PER_SEC + 1 */
EPERM, /* non-root user */
- 0,
- 0,
+ EINVAL, /* PROCESS_CPUTIME_ID */
+ EINVAL, /* THREAD_CPUTIME_ID */
};
char *TCID = "clock_settime03";
@@ -70,17 +70,6 @@
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- /* PROCESS_CPUTIME_ID & THREAD_CPUTIME_ID are not supported on
- * kernel versions lower than 2.6.12 and changed back in 2.6.38
- */
- if ((tst_kvercmp(2, 6, 12)) < 0 || (tst_kvercmp(2, 6, 38)) >= 0) {
- testcases[7] = EINVAL;
- testcases[8] = EINVAL;
- } else {
- testcases[7] = EFAULT;
- testcases[8] = EFAULT;
- }
-
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -168,11 +157,6 @@
return -1;
}
break;
- case 7:
- case 8:
- /* Make tp argument bad pointer */
- if (tst_kvercmp(2, 6, 12) >= 0)
- temp = (struct timespec *)-1;
}
return 0;
}
diff --git a/testcases/lib/cmdlib.sh b/testcases/lib/cmdlib.sh
index b7eee1a..d6f43d2 100644
--- a/testcases/lib/cmdlib.sh
+++ b/testcases/lib/cmdlib.sh
@@ -158,6 +158,24 @@
HAVE_SYSTEMCTL=0
fi
+# Check to see if syslogd, syslog-ng or rsyslogd exists
+SYSLOG_DAEMON=""
+if command -v syslogd >/dev/null 2>&1; then
+ SYSLOG_DAEMON="syslog"
+elif command -v syslog-ng >/dev/null 2>&1; then
+ SYSLOG_DAEMON="syslog-ng"
+elif command -v rsyslogd >/dev/null 2>&1; then
+ SYSLOG_DAEMON="rsyslog"
+fi
+
+# Check to see if cron or crond exists
+CROND_DAEMON=""
+if command -v crond >/dev/null 2>&1; then
+ CROND_DAEMON="crond"
+elif command -v cron >/dev/null 2>&1; then
+ CROND_DAEMON="cron"
+fi
+
start_daemon()
{
if [ $HAVE_SYSTEMCTL -eq 1 ]; then
@@ -188,8 +206,8 @@
restart_daemon()
{
if [ $HAVE_SYSTEMCTL -eq 1 ]; then
- systemctl start $1.service > /dev/null 2>&1
+ systemctl restart $1.service > /dev/null 2>&1
else
- service $1 start > /dev/null 2>&1
+ service $1 restart > /dev/null 2>&1
fi
}
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index 83eb8a7..a607d32 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -84,52 +84,63 @@
return $RC
fi
+ # sometimes the default telnet may be /usr/kerberos/bin/telnet
+ TELNET_COMM='/usr/bin/telnet'
+
# check if commands tst_*, xinetd, awk exists.
chk_ifexists INIT tst_resm || return $RC
chk_ifexists INIT xinetd || return $RC
chk_ifexists INIT diff || return $RC
- chk_ifexists INIT telnet || return $RC
+ chk_ifexists INIT ip || return $RC
+ chk_ifexists INIT $TELNET_COMM || return $RC
- # Create custom xinetd.conf file.
- # tst_xinetd.conf.1 config file has telnet service disabled.
- cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF || RC=$?
- defaults
- {
- instances = 25
- log_type = FILE /var/log/servicelog
- log_on_success = HOST PID
- log_on_failure = HOST RECORD
- disabled = telnet
- }
- EOF
+ IPV6_ENABLED=0
+ ip a | grep inet6 > /dev/null 2>&1
+ if [ $? -eq 0 ]
+ then
+ IPV6_ENABLED=1
+ fi
- # tst_xinetd.conf.2 config file has telnet enabled.
- cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF || RC=$?
- defaults
- {
- instances = 25
- log_type = FILE /var/log/servicelog
- log_on_success = HOST PID
- log_on_failure = HOST
- # disabled = telnet
- }
+ # Create custom xinetd.conf file.
+ # tst_xinetd.conf.1 config file has telnet service disabled.
+ cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF || RC=$?
+defaults
+{
+ instances = 25
+ log_type = FILE /var/log/servicelog
+ log_on_success = HOST PID
+ log_on_failure = HOST RECORD
+ disabled = telnet
+}
+EOF
- service telnet
- {
- socket_type = stream
- protocol = tcp
- wait = no
- user = root
- server = /usr/sbin/in.telnetd
- server_args = -n
- no_access =
- }
- EOF
+ # tst_xinetd.conf.2 config file has telnet enabled.
+ cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF || RC=$?
+defaults
+{
+ instances = 25
+ log_type = FILE /var/log/servicelog
+ log_on_success = HOST PID
+ log_on_failure = HOST
+ # disabled = telnet
+}
+
+service telnet
+{
+ socket_type = stream
+ protocol = tcp
+ wait = no
+ user = root
+ server = /usr/sbin/in.telnetd
+ server_args = -n
+ no_access =
+}
+EOF
# Create expected file with telnet disabled.
cat > $LTPTMP/tst_xinetd.exp.1 <<-EOF || RC=$?
- telnet: Unable to connect to remote host: Connection refused
- EOF
+telnet: connect to address 127.0.0.1: Connection refused
+EOF
if [ $RC -ne 0 ]
then
@@ -138,21 +149,50 @@
return $RC
fi
+ if [ $IPV6_ENABLED -eq 1 ]
+ then
+ cat > $LTPTMP/tst_xinetd.exp.1.ipv6 <<-EOF || RC=$?
+telnet: connect to address ::1: Connection refused
+EOF
+
+ if [ $RC -ne 0 ]
+ then
+ tst_brkm TBROK NULL \
+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.1"
+ fi
+ fi
+
# Create expected file with telnet enabled.
- cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF || RC=$?
- Trying 127.0.0.1...
- Connected to localhost (127.0.0.1).
- Escape character is '^]'.
- Connection closed by foreign host.
- EOF
+ cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF || RC=$?
+Trying 127.0.0.1...
+Connected to 127.0.0.1.
+Escape character is '^]'.
+Connection closed by foreign host.
+EOF
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
- "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.1"
+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.2"
return $RC
fi
+ if [ $IPV6_ENABLED -eq 1 ]
+ then
+ cat > $LTPTMP/tst_xinetd.exp.2.ipv6 <<-EOF || RC=$?
+Trying ::1...
+Connected to ::1.
+Escape character is '^]'.
+Connection closed by foreign host.
+EOF
+
+ if [ $RC -ne 0 ]
+ then
+ tst_brkm TBROK NULL \
+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.2.ipv6"
+ fi
+ fi
+
return $RC
}
@@ -165,28 +205,28 @@
# - non-zero on failure.
cleanup()
{
- RC=0
- # restore the original xinetd.conf if a back up exits.
- if [ -f /etc/xinetd.conf.orig ]
- then
- mv /etc/xinetd.conf.orig /etc/xinetd.conf \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
- if [ $RC -ne 0 ]
- then
- tst_res TINFO $LTPTMP/tst_xinetd.err \
- "CLEANUP: failed restoring original xinetd.conf RC=$RC. Details:"
- fi
+ RC=0
+ # restore the original xinetd.conf if a back up exits.
+ if [ -f /etc/xinetd.conf.orig ]
+ then
+ mv /etc/xinetd.conf.orig /etc/xinetd.conf \
+ > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ tst_res TINFO $LTPTMP/tst_xinetd.err \
+ "CLEANUP: failed restoring original xinetd.conf RC=$RC. Details:"
+ fi
- sleep 1s
+ sleep 1s
- # restoring original services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
- if [ $RC -ne 0 ]
- then
- tst_res TINFO $LTPTMP/tst_xinetd.err \
- "CLEANUP: failed restoring original services RC=$RC. Details:"
- fi
- fi
+ # restoring original services
+ /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ tst_res TINFO $LTPTMP/tst_xinetd.err \
+ "CLEANUP: failed restoring original services RC=$RC. Details:"
+ fi
+ fi
# remove all the temporary files created by this test.
tst_resm TINFO "CLEAN: removing $LTPTMP"
@@ -214,9 +254,9 @@
tst_resm TINFO "Test #1: restart xinetd with telnet disabled."
- # create a backup of the original xinetd.conf file.
- mv /etc/xinetd.conf /etc/xinetd.conf.orig > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ # create a backup of the original xinetd.conf file.
+ mv /etc/xinetd.conf /etc/xinetd.conf.orig > $LTPTMP/tst_xinetd.err 2>&1 \
+ || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -224,9 +264,9 @@
return $RC
fi
- # install the new config file with telnet disabled.
- mv $LTPTMP/tst_xinetd.conf.1 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ # install the new config file with telnet disabled.
+ mv $LTPTMP/tst_xinetd.conf.1 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
+ || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -236,36 +276,49 @@
tst_resm TINFO "Test #1: new xinetd.conf installed with telnet disabled."
- sleep 1s
+ sleep 1s
- # restart xinetd to re-start the services
+ # restart xinetd to re-start the services
/etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.out \
"Test #1: unable to restart service with telnet disabled. Details:"
return $RC
- else
- # even if xinetd restart has zero exit value,
- # make certain there was no failure.
- grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
- if [ $RC -eq 0 ]
- then
- tst_res TFAIL $LTPTMP/tst_xinetd.err \
- "Test #1: xinetd failed to restart. Details"
- return $RC
- else
- RC=0
- tst_resm TINFO \
- "Test #1: xinetd re-started successfully with telnet disabled."
- fi
- fi
+ else
+ # even if xinetd restart has zero exit value,
+ # make certain there was no failure.
+ grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ if [ $RC -eq 0 ]
+ then
+ tst_res TFAIL $LTPTMP/tst_xinetd.err \
+ "Test #1: xinetd failed to restart. Details"
+ return $RC
+ else
+ RC=0
+ tst_resm TINFO \
+ "Test #1: xinetd re-started successfully with telnet disabled."
+ fi
+ fi
- # Not checking for exit code from telnet command because telnet is
- # not terminated by the test gracefully.
- echo "" | telnet localhost 2>$LTPTMP/tst_xinetd.out 1>/dev/null
- diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.1 \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ # Not checking for exit code from telnet command because telnet is
+ # not terminated by the test gracefully.
+ if [ $IPV6_ENABLED -eq 1 ]
+ then
+ echo "" | $TELNET_COMM ::1 2>$LTPTMP/tst_xinetd.out.ipv6 1>/dev/null
+ diff -iwB $LTPTMP/tst_xinetd.out.ipv6 $LTPTMP/tst_xinetd.exp.1.ipv6 \
+ > $LTPTMP/tst_xinetd.err.ipv6 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
+ "Test #1: with telnet diabled expected out differs RC=$RC. Details:"
+ return $RC
+ fi
+ fi
+
+ echo "" | $TELNET_COMM 127.0.0.1 2>$LTPTMP/tst_xinetd.out 1>/dev/null
+ diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.1 \
+ > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
@@ -274,9 +327,9 @@
fi
tst_resm TINFO "Test #1: restart xinetd with telnet enabled."
- # install the xinetd config file with telnet enabled.
- mv $LTPTMP/tst_xinetd.conf.2 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ # install the xinetd config file with telnet enabled.
+ mv $LTPTMP/tst_xinetd.conf.2 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
+ || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -286,44 +339,60 @@
tst_resm TINFO "Test #1: new xinetd.conf installed with telnet enabled."
- sleep 1s
+ sleep 1s
- # restart services.
+ # restart services.
/etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.out \
"Test #1: unable to restart services with telnet enabled. Details:"
return $RC
- else
- # even if restart has a zero exit value double check for failure.
- grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
- if [ $RC -eq 0 ]
- then
- tst_res TFAIL $LTPTMP/tst_xinetd.err \
- "Test #1: xinetd failed to restart. Details"
- return $RC
- else
- RC=0
- tst_resm TINFO \
- "Test #1: xinetd re-started successfully with telnet enabled."
- fi
- fi
+ else
+ # even if restart has a zero exit value double check for failure.
+ grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ if [ $RC -eq 0 ]
+ then
+ tst_res TFAIL $LTPTMP/tst_xinetd.err \
+ "Test #1: xinetd failed to restart. Details"
+ return $RC
+ else
+ RC=0
+ tst_resm TINFO \
+ "Test #1: xinetd re-started successfully with telnet enabled."
+ fi
+ fi
- # Not checking for exit code from telnet command because telnet is
- # not terminated by the test gracefully.
- echo "" | telnet localhost > $LTPTMP/tst_xinetd.out 2>&1
+ # Not checking for exit code from telnet command because telnet is
+ # not terminated by the test gracefully.
+ if [ $IPV6_ENABLED -eq 1 ]
+ then
+ echo "" | $TELNET_COMM ::1 >$LTPTMP/tst_xinetd.out.ipv6 2>&1
+ diff -iwB $LTPTMP/tst_xinetd.out.ipv6 $LTPTMP/tst_xinetd.exp.2.ipv6 \
+ > $LTPTMP/tst_xinetd.err.ipv6 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
+ "Test #1: with telnet diabled expected out differs RC=$RC. Details:"
+ return $RC
+ else
+ tst_resm TPASS \
+ "Test #1: xinetd reads the config file and starts or stops IPv6 services."
+ fi
+ fi
- diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.2 \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ echo "" | $TELNET_COMM 127.0.0.1 > $LTPTMP/tst_xinetd.out 2>&1
+
+ diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.2 \
+ > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
"Test #1: expected output differes from actual. Details:"
return $RC
- else
- tst_resm TPASS \
- "Test #1: xinetd reads the config file and starts or stops services."
+ else
+ tst_resm TPASS \
+ "Test #1: xinetd reads the config file and starts or stops services."
fi
return $RC
diff --git a/testscripts/test_robind.sh b/testscripts/test_robind.sh
index 142678a..4c01f4e 100755
--- a/testscripts/test_robind.sh
+++ b/testscripts/test_robind.sh
@@ -193,7 +193,7 @@
echo >> $PASSLOG
fi
# Remove all the temp-files created.
- eval rm -rf ${TMPDIR}/${dir}/* > /dev/null 2>&1 /dev/null || true
+ eval rm -rf ${TMPDIR}/${dir}/* > /dev/null 2>&1 || true
unset TDIRECTORY
popd
}