From 80d069a72c48cbbcf1f42c783318798d698f7dda Mon Sep 17 00:00:00 2001 From: Jule Anger Date: Thu, 31 Mar 2022 14:40:17 +0200 Subject: [PATCH] s3:tests: Add a test to check json output of smbstatus profile Signed-off-by: Jule Anger Reviewed-by: Ralph Boehme Autobuild-User(master): Jule Anger Autobuild-Date(master): Mon Aug 8 14:01:45 UTC 2022 on sn-devel-184 --- source3/script/tests/test_smbstatus.sh | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/source3/script/tests/test_smbstatus.sh b/source3/script/tests/test_smbstatus.sh index 6b58580f0b9..0eb186e3d86 100755 --- a/source3/script/tests/test_smbstatus.sh +++ b/source3/script/tests/test_smbstatus.sh @@ -392,6 +392,91 @@ EOF return 0 } +test_smbstatus_json_profile() +{ + local status_json=smbstatus_output_json_profile + + cmd="UID_WRAPPER_INITIAL_RUID=0 UID_WRAPPER_INITIAL_EUID=0 $SMBSTATUS --json --profile > $PREFIX/$status_json" + out=$(eval $cmd) + ret=$? + + if [ $ret -ne 0 ]; then + echo "Failed to run smbstatus -jP with error $ret" + echo "$out" + return 1 + fi + + echo $out | grep -c 'JSON support not available, please install lib Jansson' + ret=$? + if [ $ret -eq 0 ]; then + subunit_start_test "test_smbstatus_json_profile" + subunit_skip_test "test_smbstatus_json_profile" <