Merge lp:~elopio/snappy/go-tests6 into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/snappy/go-tests6
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Prerequisite: lp:~fgimenez/snappy/cross-compile-debs
Diff against target: 98 lines (+35/-23)
1 file modified
_integration-tests/main.go (+35/-23)
To merge this branch: bzr merge lp:~elopio/snappy/go-tests6
Reviewer Review Type Date Requested Status
Federico Gimenez Pending
Snappy Developers Pending
Review via email: mp+262427@code.launchpad.net

This proposal has been superseded by a proposal from 2015-06-19.

To post a comment you must log in.
lp:~elopio/snappy/go-tests6 updated
513. By Leo Arias

Prettify a little.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '_integration-tests/main.go'
--- _integration-tests/main.go 2015-06-19 09:02:20 +0000
+++ _integration-tests/main.go 2015-06-19 09:02:20 +0000
@@ -22,15 +22,20 @@
22 imageDir = filepath.Join(baseDir, "image")22 imageDir = filepath.Join(baseDir, "image")
23 outputDir = filepath.Join(baseDir, "output")23 outputDir = filepath.Join(baseDir, "output")
24 imageTarget = filepath.Join(imageDir, "snappy.img")24 imageTarget = filepath.Join(imageDir, "snappy.img")
25 commonSSHOptions = []string{25 commonSSHOptions = []string{"---", "ssh"}
26 "ssh", "-s", "/usr/share/autopkgtest/ssh-setup/snappy"}26 kvmSSHOptions = append(
27 kvmSSHOptions = append(commonSSHOptions, []string{"--", "-i", imageTarget}...)27 commonSSHOptions,
28 debsDir string28 []string{
29 arch string29 "-s", "/usr/share/autopkgtest/ssh-setup/snappy",
30 testbedIP string30 "--", "-i", imageTarget}...)
31 useFlashedImage bool
32 debsDir string
33 arch string
34 testbedIP string
31)35)
3236
33func init() {37func init() {
38 flag.BoolVar(&useFlashedImage, "installed-image", false, "Wether we should install the snappy version from the branch or use the one installed on the image")
34 flag.StringVar(&debsDir, "debs-dir", defaultDebsDir, "Directory with the snappy debian packages.")39 flag.StringVar(&debsDir, "debs-dir", defaultDebsDir, "Directory with the snappy debian packages.")
35 flag.StringVar(&arch, "arch", defaultArch, "Target architecture (amd64, armhf)")40 flag.StringVar(&arch, "arch", defaultArch, "Target architecture (amd64, armhf)")
36 flag.StringVar(&testbedIP, "ip", "", "IP of the testbed to run the tests in")41 flag.StringVar(&testbedIP, "ip", "", "IP of the testbed to run the tests in")
@@ -78,29 +83,35 @@
78 "--developer-mode")83 "--developer-mode")
79}84}
8085
81func adtRun(rootPath string, sshOptions []string) {86func adtRun(rootPath string, testbedOptions []string) {
82 fmt.Println("Calling adt-run...")87 fmt.Println("Calling adt-run...")
83 prepareTargetDir(outputDir)88 prepareTargetDir(outputDir)
84 cmd := []string{"adt-run",89 cmd := []string{
85 "-B",90 "adt-run", "-B",
86 "--setup-commands", "touch /run/autopkgtest_no_reboot.stamp",
87 "--setup-commands", "mount -o remount,rw /",
88 "--setup-commands",
89 fmt.Sprintf("dpkg -i %s/*deb", debsTestBedPath),
90 "--setup-commands",
91 "sync; sleep 2; mount -o remount,ro /",
92 "--override-control", "debian/integration-tests/control",91 "--override-control", "debian/integration-tests/control",
93 "--built-tree", rootPath,92 "--built-tree", rootPath,
94 "--output-dir", outputDir,93 "--output-dir", outputDir}
95 fmt.Sprintf("--copy=%s:%s", debsDir, debsTestBedPath),94
96 "---"}95 if !useFlashedImage {
97 execCommand(append(cmd, sshOptions...)...)96 debsSetup := []string{
97 "--setup-commands", "touch /run/autopkgtest_no_reboot.stamp",
98 "--setup-commands", "mount -o remount,rw /",
99 "--setup-commands",
100 fmt.Sprintf("dpkg -i %s/*deb", debsTestBedPath),
101 "--setup-commands",
102 "sync; sleep 2; mount -o remount,ro /",
103 fmt.Sprintf("--copy=%s:%s", debsDir, debsTestBedPath)}
104 cmd = append(cmd, debsSetup...)
105 }
106
107 execCommand(append(cmd, testbedOptions...)...)
98}108}
99109
100func remoteTestbedSSHOptions(testbedIP string) []string {110func remoteTestbedSSHOptions(testbedIP string) []string {
101 options := []string{111 options := []string{
102 "-H", testbedIP,112 "-H", testbedIP,
103 }113 "-l", "ubuntu",
114 "-i", filepath.Join(os.Getenv("HOME"), ".ssh", "id_rsa")}
104 return append(commonSSHOptions, options...)115 return append(commonSSHOptions, options...)
105}116}
106117
@@ -129,13 +140,14 @@
129140
130 rootPath := getRootPath()141 rootPath := getRootPath()
131142
132 if debsDir == defaultDebsDir {143 if !useFlashedImage && debsDir == defaultDebsDir {
133 buildDebs(rootPath, arch)144 buildDebs(rootPath, arch)
134 }145 }
135 if arch == defaultArch {146 if testbedIP == "" {
136 createImage(defaultRelease, defaultChannel, getArchForImage())147 createImage(defaultRelease, defaultChannel, getArchForImage())
137 adtRun(rootPath, kvmSSHOptions)148 adtRun(rootPath, kvmSSHOptions)
138 } else {149 } else {
139 //adtRun(rootPath, remoteTestbedSSHOptions(testbedIP))150 execCommand("ssh-copy-id", "ubuntu@"+testbedIP)
151 adtRun(rootPath, remoteTestbedSSHOptions(testbedIP))
140 }152 }
141}153}

Subscribers

People subscribed via source and target branches