2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

selftests: bpf: Skip write only files in debugfs

DebugFS for netdevsim now contains some "action trigger" files
which are write only. Don't try to capture the contents of those.

Note that we can't use os.access() because the script requires
root.

Fixes: 4418f862d6 ("netdevsim: implement support for devlink region and snapshots")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2019-10-31 20:06:58 -07:00 committed by David S. Miller
parent d64479a3e3
commit 8101e06941

View File

@ -22,6 +22,7 @@ import os
import pprint
import random
import re
import stat
import string
import struct
import subprocess
@ -311,7 +312,11 @@ class DebugfsDir:
for f in out.split():
if f == "ports":
continue
p = os.path.join(path, f)
if not os.stat(p).st_mode & stat.S_IRUSR:
continue
if os.path.isfile(p):
_, out = cmd('cat %s/%s' % (path, f))
dfs[f] = out.strip()