From: Karel Zak Date: Mon, 15 Jun 2015 12:02:36 +0000 (+0200) Subject: tests: add JSON sfdisk dumps X-Git-Tag: v2.27-rc1~145 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=314ca59fbf666c9323d225be2158787e8fc53345;p=thirdparty%2Futil-linux.git tests: add JSON sfdisk dumps Signed-off-by: Karel Zak --- diff --git a/tests/expected/sfdisk/dos-write-json b/tests/expected/sfdisk/dos-write-json new file mode 100644 index 0000000000..463590f224 --- /dev/null +++ b/tests/expected/sfdisk/dos-write-json @@ -0,0 +1,16 @@ +{ + "partitiontable": { + "label": "dos", + "id": "0x1ddc8a79", + "device": "", + "unit": "sectors", + "partitions": [ + {"node": "1", "start": 2048, "size": 6144, "type": "83", "bootable": true}, + {"node": "2", "start": 8192, "size": 6144, "type": "82"}, + {"node": "3", "start": 14336, "size": 6144, "type": "83"}, + {"node": "4", "start": 20480, "size": 81920, "type": "5"}, + {"node": "5", "start": 20481, "size": 6144, "type": "83"}, + {"node": "6", "start": 26626, "size": 75774, "type": "83"} + ] + } +} diff --git a/tests/expected/sfdisk/gpt-write-json b/tests/expected/sfdisk/gpt-write-json new file mode 100644 index 0000000000..48aec21184 --- /dev/null +++ b/tests/expected/sfdisk/gpt-write-json @@ -0,0 +1,16 @@ +{ + "partitiontable": { + "label": "gpt", + "id": "3B8559DB-33AF-43E9-BEFC-C331D829B539", + "device": "", + "unit": "sectors", + "firstlba": 2048, + "lastlba": 102366, + "partitions": [ + {"node": "1", "start": 2048, "size": 6144, "type": "44479540-F297-41B2-9AF7-D131D5F0458A", "uuid": "4DD6948A-44F8-4E6C-8BDC-064F740704F8"}, + {"node": "2", "start": 8192, "size": 6144, "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid": "44B51DEF-5F04-465A-91AA-2889A62D8E49"}, + {"node": "3", "start": 14336, "size": 6144, "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid": "643E1D0D-BC02-4CED-B83B-86121062858F"}, + {"node": "4", "start": 20480, "size": 81887, "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid": "D2A29B0A-FDEE-40C3-9BAE-B9FA782C986C", "name": "GPT is the best"} + ] + } +} diff --git a/tests/ts/sfdisk/dos b/tests/ts/sfdisk/dos index 467e540f48..dbcccf9cbc 100755 --- a/tests/ts/sfdisk/dos +++ b/tests/ts/sfdisk/dos @@ -89,6 +89,13 @@ $TS_CMD_SFDISK --unit S --dump ${TS_DEVICE} >> $TS_OUTPUT 2>&1 ts_fdisk_clean $TS_DEVICE ts_finalize_subtest + +ts_init_subtest "write-json" +$TS_CMD_SFDISK --json ${TS_DEVICE} >> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +ts_finalize_subtest + + # # Test first LBA smaller than libfdisk default (~1MiB) and small gaps between # logical partitions (just only one sector for EBR). diff --git a/tests/ts/sfdisk/gpt b/tests/ts/sfdisk/gpt index 3d65e135f4..bb0243d30b 100755 --- a/tests/ts/sfdisk/gpt +++ b/tests/ts/sfdisk/gpt @@ -110,6 +110,12 @@ ts_fdisk_clean $TS_DEVICE ts_finalize_subtest +ts_init_subtest "write-json" +$TS_CMD_SFDISK --json ${TS_DEVICE} >> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +ts_finalize_subtest + + ts_init_subtest "list-pmbr" $TS_CMD_SFDISK --list --label-nested dos ${TS_DEVICE} >> $TS_OUTPUT 2>&1 ts_fdisk_clean $TS_DEVICE