]> err.no Git - util-linux/commitdiff
ipcs: add regression test for output headers
authorKarel Zak <kzak@redhat.com>
Tue, 2 Jan 2007 23:42:23 +0000 (00:42 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 4 Jan 2007 13:41:29 +0000 (14:41 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/Makefile.am
tests/commands.sh.in
tests/expected/ts-ipcs-headers [new file with mode: 0644]
tests/functions.sh
tests/run.sh
tests/ts-ipcs-headers [new file with mode: 0755]

index 65cd57a52ecfdb4da61507089a61fd11758c6445..80d8b98d9235a6ed27f8200ddbe2a54c950962d0 100644 (file)
@@ -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
index ecdb9b948cad01733040580416e457372a286d8f..54d57a8a4d26c221991b23b331aef7289fe1b23a 100644 (file)
@@ -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 (file)
index 0000000..d423c57
--- /dev/null
@@ -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 --------
index 64392e4d5fa1c12f3a708f296f6b905d9446f0ac..2a18ef583279cd2392630bd1a624c3ef6b05b2b7 100644 (file)
@@ -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"
index b4ca51b57cfdf6681025f5560ca5831a156209df..275b687336b53bbd684a4311aa93798f8559fdd0 100755 (executable)
@@ -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 (executable)
index 0000000..62b1856
--- /dev/null
@@ -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
+