]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: add JSON compact format output subtest.
authorWanBingjiang <wanbingjiang@webray.com.cn>
Thu, 5 Feb 2026 09:30:12 +0000 (17:30 +0800)
committerWanBingjiang <wanbingjiang@webray.com.cn>
Mon, 23 Feb 2026 08:13:16 +0000 (16:13 +0800)
tests/expected/column/table-json-compact [new file with mode: 0644]
tests/ts/column/table

diff --git a/tests/expected/column/table-json-compact b/tests/expected/column/table-json-compact
new file mode 100644 (file)
index 0000000..6401a7c
--- /dev/null
@@ -0,0 +1,43 @@
+{"mountinfo":[
+{"target":"/sys","source":"sysfs","type":"sysfs","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/proc","source":"proc","type":"proc","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/dev","source":"devtmpfs","type":"devtmpfs","vfs-opts":"rw,nosuid"},
+{"target":"/sys/kernel/security","source":"securityfs","type":"securityfs","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/dev/shm","source":"tmpfs","type":"tmpfs","vfs-opts":"rw,nosuid,nodev"},
+{"target":"/dev/pts","source":"devpts","type":"devpts","vfs-opts":"rw,nosuid,noexec,relatime"},
+{"target":"/run","source":"tmpfs","type":"tmpfs","vfs-opts":"rw,nosuid,nodev"},
+{"target":"/sys/fs/cgroup","source":"tmpfs","type":"tmpfs","vfs-opts":"ro,nosuid,nodev,noexec"},
+{"target":"/sys/fs/cgroup/systemd","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/pstore","source":"pstore","type":"pstore","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/firmware/efi/efivars","source":"efivarfs","type":"efivarfs","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/blkio","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/cpu,cpuacct","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/devices","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/hugetlb","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/pids","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/memory","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/cpuset","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/perf_event","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/net_cls,net_prio","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/fs/cgroup/freezer","source":"cgroup","type":"cgroup","vfs-opts":"rw,nosuid,nodev,noexec,relatime"},
+{"target":"/sys/kernel/config","source":"configfs","type":"configfs","vfs-opts":"rw,relatime"},
+{"target":"/","source":"/dev/sda4","type":"ext4","vfs-opts":"rw,relatime"},
+{"target":"/proc/sys/fs/binfmt_misc","source":"systemd-1","type":"autofs","vfs-opts":"rw,relatime"},
+{"target":"/sys/kernel/debug","source":"debugfs","type":"debugfs","vfs-opts":"rw,relatime"},
+{"target":"/dev/hugepages","source":"hugetlbfs","type":"hugetlbfs","vfs-opts":"rw,relatime"},
+{"target":"/dev/mqueue","source":"mqueue","type":"mqueue","vfs-opts":"rw,relatime"},
+{"target":"/proc/sys/fs/binfmt_misc","source":"binfmt_misc","type":"binfmt_misc","vfs-opts":"rw,relatime"},
+{"target":"/proc/fs/nfsd","source":"nfsd","type":"nfsd","vfs-opts":"rw,relatime"},
+{"target":"/tmp","source":"tmpfs","type":"tmpfs","vfs-opts":"rw,nosuid,nodev"},
+{"target":"/home","source":"/dev/sda3","type":"ext4","vfs-opts":"rw,relatime"},
+{"target":"/boot","source":"/dev/sda2","type":"ext4","vfs-opts":"rw,relatime"},
+{"target":"/home/games","source":"/dev/sda5","type":"ext4","vfs-opts":"rw,relatime"},
+{"target":"/boot/efi","source":"/dev/sda1","type":"vfat","vfs-opts":"rw,relatime"},
+{"target":"/home/archive","source":"/dev/sdb1","type":"ext4","vfs-opts":"rw,relatime"},
+{"target":"/var/lib/nfs/rpc_pipefs","source":"sunrpc","type":"rpc_pipefs","vfs-opts":"rw,relatime"},
+{"target":"/sys/fs/fuse/connections","source":"fusectl","type":"fusectl","vfs-opts":"rw,relatime"},
+{"target":"/run/user/1000","source":"tmpfs","type":"tmpfs","vfs-opts":"rw,nosuid,nodev,relatime"},
+{"target":"/run/user/1000/gvfs","source":"gvfsd-fuse","type":"fuse.gvfsd-fuse","vfs-opts":"rw,nosuid,nodev,relatime"},
+{"target":"/run/user/0","source":"tmpfs","type":"tmpfs","vfs-opts":"rw,nosuid,nodev,relatime"},
+{"target":"/mnt/sounds","source":"//sr.net.home/sounds","type":"cifs","vfs-opts":"rw,relatime"}
+]}
index 933fa1e396f5699b594da8c9a9e4148651f585ee..01127bbc6b5dcd9af69e46b87c6b3c5dce5ae667 100755 (executable)
@@ -150,6 +150,17 @@ LIBSMARTCOLS_JSON=lines $TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
                >> $TS_OUTPUT 2>> $TS_ERRLOG
 ts_finalize_subtest
 
+ts_init_subtest "json-compact"
+LIBSMARTCOLS_JSON=compact $TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+               --table-name "mountinfo" \
+               --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+               --table-hide=SEP,ID,PARENT,ROOT,PROP,FS-OPTS,MAJMIN \
+               --table-order TARGET,SOURCE,TYPE,VFS-OPTS \
+               --json \
+               --output-width 110 \
+               >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
 ts_init_subtest "use-spaces"
 $TS_CMD_COLUMN  --table $TS_SELF/files/mountinfo \
                --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \