]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (lsfd::mkfds-bpf-prog) verify BPF-PROG.{ID,TAG} column
authorMasatake YAMATO <yamato@redhat.com>
Fri, 25 Oct 2024 20:41:29 +0000 (05:41 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 25 Oct 2024 20:55:36 +0000 (05:55 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/expected/lsfd/mkfds-bpf-prog
tests/ts/lsfd/mkfds-bpf-prog

index b67afc540f0b11452addfd50160d1d12701682e1..0b2478d27e365a5201aee8af621b0602873773b7 100644 (file)
@@ -1,2 +1,4 @@
 kprobe 2 mkdfs_prog
 BPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME: 0
+comparing  ids: OK
+comparing  tags: OK
index 1c1df1ef59f94bce958f528a8a8370a0a390dcc6..1ec4cbf8ffefa04dc004685c0735c4fd7bc3eac1 100755 (executable)
@@ -29,14 +29,30 @@ ts_check_test_command "$TS_HELPER_MKFDS"
 ts_cd "$TS_OUTDIR"
 
 PID=
+ID=
+TAG=
 FD=3
 NAME=mkdfs_prog
 {
     coproc MKFDS { "$TS_HELPER_MKFDS" bpf-prog "$FD" prog-type-id=2 name="$NAME"; }
-    if read -r -u "${MKFDS[0]}" PID UNUSED; then
+    if read -r -u "${MKFDS[0]}" PID ID TAG; then
        "${TS_CMD_LSFD}" -r -n -oBPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME -p "${PID}" -Q "(FD == $FD)"
        echo "BPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME": $?
 
+       ID_0=$("${TS_CMD_LSFD}" -r -n -oBPF-PROG.ID -p "${PID}" -Q "(FD == $FD)")
+       if [[ "${ID_0}" == "${ID}" ]]; then
+           echo "comparing  ids": OK
+       else
+           echo "comparing  ids": FAILED "ID_0:${ID_0} == ID:${ID}"
+       fi
+
+       TAG_0=$("${TS_CMD_LSFD}" -r -n -oBPF-PROG.TAG -p "${PID}" -Q "(FD == $FD)")
+       if [[ "${TAG_0}" == "${TAG}" ]]; then
+           echo "comparing  tags": OK
+       else
+           echo "comparing  tags": FAILED "TAG_0:${TAG_0} == TAG:${TAG}"
+       fi
+
        echo DONE >&"${MKFDS[1]}"
     fi
     wait "${MKFDS_PID}"