]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (lsfd) add more cases for packet sockets
authorMasatake YAMATO <yamato@redhat.com>
Fri, 3 Mar 2023 06:58:18 +0000 (15:58 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Sun, 5 Mar 2023 18:17:30 +0000 (03:17 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/expected/lsfd/mkfds-mapped-packet-socket
tests/ts/lsfd/mkfds-mapped-packet-socket

index 59bc863b95e17e722280b1b0e225f983e1b6e40f..7c1b5037d04e4d6007363ef86088d9bacd7584b0 100644 (file)
@@ -1,2 +1,8 @@
         PACKET
 SOCK.PROTONAME: 0
+type=raw protocol=all iface=lo       raw         PACKET           lo             all
+NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL: 0
+        PACKET
+SOCK.PROTONAME: 0
+type=dgram protocol=all iface=lo     dgram         PACKET           lo             all
+NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL: 0
index 1ee61d5d972d9548d38db1a702c226fa85af907d..6844e75e5a586eea540af06a215c054a1574183b 100755 (executable)
@@ -33,20 +33,31 @@ PID=
 FD=3
 EXPR=
 INTERFACE=lo
+SOCKTYPE=
+ERR=
 
-{
-    coproc MKFDS { "$TS_HELPER_MKFDS" mapped-packet-socket $FD interface=${INTERFACE}; }
+for SOCKTYPE in RAW DGRAM; do
+    coproc MKFDS { "$TS_HELPER_MKFDS" mapped-packet-socket $FD \
+                                     interface=${INTERFACE} socktype=${SOCKTYPE}; }
     if read -u ${MKFDS[0]} PID; then
        EXPR='(ASSOC == "shm") and (STTYPE == "SOCK") and (MODE == "-w-")'
        ${TS_CMD_LSFD} -p "$PID" -n -o SOCK.PROTONAME -Q "${EXPR}"
        echo 'SOCK.PROTONAME': $?
+
+       EXPR="(FD == $FD)"
+       ${TS_CMD_LSFD} -p "$PID" -n -o NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL -Q "${EXPR}"
+       echo 'NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL': $?
+
        kill -CONT ${PID}
     fi
-
     wait ${MKFDS_PID}
-} > $TS_OUTPUT 2>&1
+    ERR=$?
+    if [ $ERR != 0 ]; then
+          break
+    fi
+done > $TS_OUTPUT 2>&1
 
-if [[ $? == "$ENOPROTOOPT" ]]; then
+if [[ "$ERR" == "$ENOPROTOOPT" ]]; then
     ts_skip "packet socket doesn't support attaching a buffer on this platform"
 fi