28
. "launchpad.net/snappy/_integration-tests/testutils/common"
28
"launchpad.net/snappy/_integration-tests/testutils/cli"
29
"launchpad.net/snappy/_integration-tests/testutils/common"
29
30
"launchpad.net/snappy/_integration-tests/testutils/partition"
31
32
"gopkg.in/check.v1"
45
46
type zeroSizeSystemd struct{}
47
48
func (zeroSizeKernel) set(c *check.C) {
48
commonSet(c, BaseAltPartitionPath, origBootFilenamePattern, kernelFilename)
49
commonSet(c, common.BaseAltPartitionPath, origBootFilenamePattern, kernelFilename)
51
52
func (zeroSizeKernel) unset(c *check.C) {
52
commonUnset(c, BaseAltPartitionPath, origBootFilenamePattern, kernelFilename)
53
commonUnset(c, common.BaseAltPartitionPath, origBootFilenamePattern, kernelFilename)
55
56
func (zeroSizeInitrd) set(c *check.C) {
73
74
func (zeroSizeSystemd) set(c *check.C) {
74
commonSet(c, BaseAltPartitionPath, origSystemdFilenamePattern, systemdFilename)
75
commonSet(c, common.BaseAltPartitionPath, origSystemdFilenamePattern, systemdFilename)
77
78
func (zeroSizeSystemd) unset(c *check.C) {
78
commonUnset(c, BaseAltPartitionPath, origSystemdFilenamePattern, systemdFilename)
79
commonUnset(c, common.BaseAltPartitionPath, origSystemdFilenamePattern, systemdFilename)
81
82
func commonSet(c *check.C, baseOtherPath, origPattern, filename string) {
105
106
func renameFile(c *check.C, basePath, oldFilename, newFilename string, keepOld bool) {
106
107
// Only need to make writable and revert for BaseAltPartitionPath,
107
108
// kernel files' boot directory is writable
108
if basePath == BaseAltPartitionPath {
109
MakeWritable(c, basePath)
110
defer MakeReadonly(c, basePath)
109
if basePath == common.BaseAltPartitionPath {
110
partition.MakeWritable(c, basePath)
111
defer partition.MakeReadonly(c, basePath)
113
ExecCommand(c, "sudo", "mv", oldFilename, newFilename)
114
cli.ExecCommand(c, "sudo", "mv", oldFilename, newFilename)
116
ExecCommand(c, "sudo", "touch", oldFilename)
117
cli.ExecCommand(c, "sudo", "touch", oldFilename)
117
118
mode := getFileMode(c, newFilename)
118
ExecCommand(c, "sudo", "chmod", fmt.Sprintf("%o", mode), oldFilename)
119
cli.ExecCommand(c, "sudo", "chmod", fmt.Sprintf("%o", mode), oldFilename)