From 97cdb3cb5c7c20da3bc28962001b33c4ea083d69 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 3 Jan 2007 00:42:23 +0100 Subject: [PATCH] ipcs: add regression test for output headers Signed-off-by: Karel Zak --- tests/Makefile.am | 4 ++- tests/commands.sh.in | 2 ++ tests/expected/ts-ipcs-headers | 64 ++++++++++++++++++++++++++++++++++ tests/functions.sh | 5 +++ tests/run.sh | 2 ++ tests/ts-ipcs-headers | 47 +++++++++++++++++++++++++ 6 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 tests/expected/ts-ipcs-headers create mode 100755 tests/ts-ipcs-headers diff --git a/tests/Makefile.am b/tests/Makefile.am index 65cd57a5..80d8b98d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,7 +3,9 @@ include $(top_srcdir)/config/include-Makefile.am EXTRA_DIST = commands.sh.in \ functions.sh \ ts-mount-paths \ - expected/ts-mount-paths + ts-ipcs-headers \ + expected/ts-mount-paths \ + expected/ts-ipcs-headers distclean-local: rm -rf output diff diff --git a/tests/commands.sh.in b/tests/commands.sh.in index ecdb9b94..54d57a8a 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -6,3 +6,5 @@ TS_CMD_MOUNT=${TS_CMD_MOUNT:-"$TOPDIR/mount/mount"} TS_CMD_UMOUNT=${TS_CMD_MOUNT:-"$TOPDIR/mount/umount"} TS_CMD_SWAPON=${TS_CMD_MOUNT:-"$TOPDIR/mount/swapon"} TS_CMD_SWAPOFF=${TS_CMD_MOUNT:-"$TOPDIR/mount/swapoff"} + +TS_CMD_IPCS=${TS_CMD_IPCS:-"$TOPDIR/sys-utils/ipcs"} diff --git a/tests/expected/ts-ipcs-headers b/tests/expected/ts-ipcs-headers new file mode 100644 index 00000000..d423c57c --- /dev/null +++ b/tests/expected/ts-ipcs-headers @@ -0,0 +1,64 @@ +test: shm headers +------ Shared Memory Attach/Detach/Change Times -------- +shmid owner attached detached changed +------ Shared Memory Creator/Last-op -------- +shmid owner cpid lpid +------ Shared Memory Segment Creators/Owners -------- +shmid perms cuid cgid uid gid +------ Shared Memory Limits -------- +------ Shared Memory Status -------- + +test: mesg headers +------ Message Queues Send/Recv/Change Times -------- +msqid owner send recv change +------ Message Queues PIDs -------- +msqid owner lspid lrpid +------ Message Queues: Creators/Owners -------- +msqid perms cuid cgid uid gid +------ Messages: Limits -------- +------ Messages: Status -------- + +test: sem headers +------ Shared Memory Operation/Change Times -------- +shmid owner last-op last-changed +------ Semaphore Arrays Creators/Owners -------- +semid perms cuid cgid uid gid +------ Semaphore Limits -------- +------ Semaphore Status -------- + +test: all headers +------ Shared Memory Segments -------- +key shmid owner perms bytes nattch status +-- +------ Semaphore Arrays -------- +key semid owner perms nsems +-- +------ Message Queues -------- +key msqid owner perms used-bytes messages +------ Shared Memory Attach/Detach/Change Times -------- +shmid owner attached detached changed +-- +------ Shared Memory Operation/Change Times -------- +shmid owner last-op last-changed +-- +------ Message Queues Send/Recv/Change Times -------- +msqid owner send recv change +------ Shared Memory Creator/Last-op -------- +shmid owner cpid lpid +-- +------ Message Queues PIDs -------- +msqid owner lspid lrpid +------ Shared Memory Segment Creators/Owners -------- +shmid perms cuid cgid uid gid +-- +------ Semaphore Arrays Creators/Owners -------- +semid perms cuid cgid uid gid +-- +------ Message Queues: Creators/Owners -------- +msqid perms cuid cgid uid gid +------ Shared Memory Limits -------- +------ Semaphore Limits -------- +------ Messages: Limits -------- +------ Shared Memory Status -------- +------ Semaphore Status -------- +------ Messages: Status -------- diff --git a/tests/functions.sh b/tests/functions.sh index 64392e4d..2a18ef58 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -15,6 +15,8 @@ function ts_init { TS_DIFF="$TS_DIFFDIR/$TS_NAME" TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME" + rm -f $TS_OUTPUT + printf "%15s: %-25s ..." "$TS_COMPONENT" "$TS_DESC" } @@ -30,6 +32,9 @@ function ts_finalize { else res=0 fi + else + echo " IGNORE (expected output undefined)" + exit 0 fi if [ $res -eq 0 ]; then echo " OK" diff --git a/tests/run.sh b/tests/run.sh index b4ca51b5..275b6873 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -6,6 +6,8 @@ echo echo "------------------ Utils-linux-ng regression tests ------------------" echo +rm -f *~ + res=0 count=0 for ts in `ls ts-*`; do diff --git a/tests/ts-ipcs-headers b/tests/ts-ipcs-headers new file mode 100755 index 00000000..62b1856a --- /dev/null +++ b/tests/ts-ipcs-headers @@ -0,0 +1,47 @@ +#!/bin/bash + +. commands.sh +. functions.sh + +TS_COMPONENT="ipcs" +TS_DESC="headers" + +ts_init + +touch $TS_OUTPUT + +echo "test: shm headers" >> $TS_OUTPUT +$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +echo "test: mesg headers" >> $TS_OUTPUT +$TS_CMD_IPCS -q -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +echo "test: sem headers" >> $TS_OUTPUT +$TS_CMD_IPCS -s -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +echo "test: all headers" >> $TS_OUTPUT +$TS_CMD_IPCS -a | grep --after-context=1 "^---" >> $TS_OUTPUT + +$TS_CMD_IPCS -a -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -u | grep "^---" >> $TS_OUTPUT + +ts_finalize + -- 2.39.5