From: WanBingjiang Date: Thu, 5 Feb 2026 09:30:12 +0000 (+0800) Subject: column: add JSON compact format output subtest. X-Git-Tag: v2.43-devel~50^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc4b2139689856e4badf652b4ad85c97e18a321e;p=thirdparty%2Futil-linux.git column: add JSON compact format output subtest. --- diff --git a/tests/expected/column/table-json-compact b/tests/expected/column/table-json-compact new file mode 100644 index 000000000..6401a7c73 --- /dev/null +++ b/tests/expected/column/table-json-compact @@ -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"} +]} diff --git a/tests/ts/column/table b/tests/ts/column/table index 933fa1e39..01127bbc6 100755 --- a/tests/ts/column/table +++ b/tests/ts/column/table @@ -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 \