From 5b0fa9ced90e4b6e037bf07f23662ada5b198bb2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 18 Feb 2017 10:08:34 +0000 Subject: [PATCH] generator: Generate stable UUID from contents of all action*.ml files. Also rename the function 'uuidgen ()' (conflicts with a same-named function in Common_utils) to 'stable_uuid'. Notice that the UUID is now only computed once per run of the generator, whereas previously the same value was computed over and over again. --- generator/actions.ml | 83 ++++++++++++++++++++------------------------ generator/utils.ml | 18 ++++++++-- generator/utils.mli | 4 +-- 3 files changed, 54 insertions(+), 51 deletions(-) diff --git a/generator/actions.ml b/generator/actions.ml index 8a897a8ae..afa915d91 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -5563,11 +5563,10 @@ C." }; style = RErr, [Device "device"; String "uuid"], []; proc_nr = Some 82; deprecated_by = Some "set_uuid"; - tests = - (let uuid = uuidgen () in [ + tests = [ InitBasicFS, Always, TestResultString ( - [["set_e2uuid"; "/dev/sda1"; uuid]; - ["get_e2uuid"; "/dev/sda1"]], uuid), []; + [["set_e2uuid"; "/dev/sda1"; stable_uuid]; + ["get_e2uuid"; "/dev/sda1"]], stable_uuid), []; InitBasicFS, Always, TestResultString ( [["set_e2uuid"; "/dev/sda1"; "clear"]; ["get_e2uuid"; "/dev/sda1"]], ""), []; @@ -5577,7 +5576,7 @@ C." }; [["set_e2uuid"; "/dev/sda1"; "random"]]), []; InitBasicFS, Always, TestRun ( [["set_e2uuid"; "/dev/sda1"; "time"]]), [] - ]); + ]; shortdesc = "set the ext2/3/4 filesystem UUID"; longdesc = "\ This sets the ext2/3/4 filesystem UUID of the filesystem on @@ -6595,7 +6594,7 @@ the command C." }; style = RErr, [Device "device"], [OString "label"; OString "uuid"]; proc_nr = Some 130; once_had_no_optargs = true; - tests = (let uuid = uuidgen () in [ + tests = [ InitEmpty, Always, TestRun ( [["part_disk"; "/dev/sda"; "mbr"]; ["mkswap"; "/dev/sda1"; "NOARG"; "NOARG"]]), []; @@ -6604,13 +6603,13 @@ the command C." }; ["mkswap"; "/dev/sda1"; "hello"; "NOARG"]]), []; InitEmpty, Always, TestResultString ( [["part_disk"; "/dev/sda"; "mbr"]; - ["mkswap"; "/dev/sda1"; "NOARG"; uuid]; - ["vfs_uuid"; "/dev/sda1"]], uuid), []; + ["mkswap"; "/dev/sda1"; "NOARG"; stable_uuid]; + ["vfs_uuid"; "/dev/sda1"]], stable_uuid), []; InitEmpty, Always, TestResultString ( [["part_disk"; "/dev/sda"; "mbr"]; - ["mkswap"; "/dev/sda1"; "hello"; uuid]; + ["mkswap"; "/dev/sda1"; "hello"; stable_uuid]; ["vfs_label"; "/dev/sda1"]], "hello"), [] - ]); + ]; shortdesc = "create a swap partition"; longdesc = "\ Create a Linux swap partition on C. @@ -6642,12 +6641,11 @@ a limitation of the kernel or swap tools." }; proc_nr = Some 132; deprecated_by = Some "mkswap"; optional = Some "linuxfsuuid"; - tests = - (let uuid = uuidgen () in [ + tests = [ InitEmpty, Always, TestRun ( [["part_disk"; "/dev/sda"; "mbr"]; - ["mkswap_U"; uuid; "/dev/sda1"]]), [] - ]); + ["mkswap_U"; stable_uuid; "/dev/sda1"]]), [] + ]; shortdesc = "create a swap partition with an explicit UUID"; longdesc = "\ Create a swap partition on C with UUID C." }; @@ -7479,13 +7477,12 @@ labeled swap partition." }; style = RErr, [String "uuid"], []; proc_nr = Some 176; optional = Some "linuxfsuuid"; - tests = - (let uuid = uuidgen () in [ + tests = [ InitEmpty, Always, TestRun ( - [["mkswap"; "/dev/sdc"; "NOARG"; uuid]; - ["swapon_uuid"; uuid]; - ["swapoff_uuid"; uuid]]), [] - ]); + [["mkswap"; "/dev/sdc"; "NOARG"; stable_uuid]; + ["swapon_uuid"; stable_uuid]; + ["swapoff_uuid"; stable_uuid]]), [] + ]; shortdesc = "enable swap on swap partition by UUID"; longdesc = "\ This command enables swap to a swap partition with the given UUID. @@ -7753,18 +7750,17 @@ This creates an ext2 external journal on C with label C