diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2021-10-12 12:26:38 +0200 |
---|---|---|
committer | nareshkamboju <naresh.kamboju@gmail.com> | 2021-10-12 17:21:21 +0530 |
commit | 2f791f16e74bf60c27581ec09fb12c8275ad4235 (patch) | |
tree | dc83794429cbd41135f8b62a8c3b85b99f66d63b /automated/lib/sh-test-lib | |
parent | f681c81194b99e1467284616bec1658c1de2f2b5 (diff) |
lib: sh-test-lib: add mount/unmount of debugfs
Add two generic functions for mounting and unmounting the debugfs.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Diffstat (limited to 'automated/lib/sh-test-lib')
-rwxr-xr-x | automated/lib/sh-test-lib | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib index ca875fca..d3b705be 100755 --- a/automated/lib/sh-test-lib +++ b/automated/lib/sh-test-lib @@ -699,3 +699,24 @@ get_test_program() { cd "$test_dir" || exit 1 fi } + +exit_cleanup() +{ + # cleanup the temp decompressed config & kernel image + [ "$mounted_debugfs" = 1 ] && umount /sys/kernel/debug 2>/dev/null +} + +mount_debugfs() +{ + if [ "$(mount | grep debugfs)" -eq 1 ]; then + # try to mount the debugfs hierarchy ourselves and remember it to umount afterwards + mount -t debugfs debugfs /sys/kernel/debug && mounted_debugfs=1 + if [ $mounted_debugfs -eq 1 ]; then + exit 0 + else + exit 1 + fi + else + exit 0 + fi +} |