]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/ipcs/mk-rm-msg
25460e25d208ccd2fbed11332dceb86d38a18901
[thirdparty/util-linux.git] / tests / ts / ipcs / mk-rm-msg
1 #!/bin/bash
2
3 # This file is part of util-linux.
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 TS_TOPDIR="${0%/*}/../.."
16 TS_DESC="mk-rm-msg"
17
18 . $TS_TOPDIR/functions.sh
19 ts_init "$*"
20
21 ts_check_test_command "$TS_CMD_IPCS"
22 ts_check_test_command "$TS_CMD_IPCMK"
23 ts_check_test_command "$TS_CMD_IPCRM"
24
25 . $TS_SELF/functions.sh
26
27 rm -f $TS_OUTDIR/id-msg
28 $TS_CMD_IPCMK -Q 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-msg
29 $TS_CMD_IPCS -q -i "$(cat $TS_OUTDIR/id-msg)" |\
30 grep -c "^Message Queue msqid=$(cat $TS_OUTDIR/id-msg)$" >>$TS_OUTPUT
31 $TS_CMD_IPCRM -q $(cat $TS_OUTDIR/id-msg) >>$TS_OUTPUT 2>&1
32
33 rm -f $TS_OUTDIR/id-msg
34 $TS_CMD_IPCMK -Q 2>>$TS_OUTPUT | ipcmk_output_handler $TS_OUTPUT $TS_OUTDIR/id-msg
35 $TS_CMD_IPCRM -Q "$(
36 $TS_CMD_IPCS -q |
37 awk -v id=$(cat $TS_OUTDIR/id-msg) '{if ($2 == id){print $1}}'
38 )" >>$TS_OUTPUT 2>&1
39
40 rm -f $TS_OUTDIR/id-msg
41
42 ts_finalize