[Merge] lp:~sergiusens/goget-ubuntu-touch/1473333 into lp:goget-ubuntu-touch

Leo Arias leo.arias at canonical.com
Fri Nov 13 03:18:13 UTC 2015


The exit(1) works. I don't understand the test and when I try to run it I get:

./main_test.go:36: undefined: execute

Maybe I'm not running it properly?

Diff comments:

> 
> === added file 'ubuntu-device-flash/main_test.go'
> --- ubuntu-device-flash/main_test.go	1970-01-01 00:00:00 +0000
> +++ ubuntu-device-flash/main_test.go	2015-11-13 03:02:15 +0000
> @@ -0,0 +1,48 @@
> +//
> +// diskimage - handles ubuntu disk images

s/diskimage/ubuntu-device-flash

> +//
> +// Copyright (c) 2015 Canonical Ltd.
> +//
> +// Written by Sergio Schvezov <sergio.schvezov at canonical.com>
> +//
> +package main
> +
> +// This program is free software: you can redistribute it and/or modify it
> +// under the terms of the GNU General Public License version 3, as published
> +// by the Free Software Foundation.
> +//
> +// This program is distributed in the hope that it will be useful, but
> +// WITHOUT ANY WARRANTY; without even the implied warranties of
> +// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
> +// PURPOSE.  See the GNU General Public License for more details.
> +//
> +// You should have received a copy of the GNU General Public License along
> +// with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +import (
> +	"fmt"
> +	"os"
> +	"os/exec"
> +
> +	. "launchpad.net/gocheck"

Shouldn't this be gopkg.in/check.v1 ?

> +)
> +
> +type ParserTestSuite struct{}
> +
> +var _ = Suite(&ParserTestSuite{})
> +
> +func (s *ParserTestSuite) TestExitStatusOnBadArgs(c *C) {
> +	if os.Getenv("BE_CRASHER") == "1" {
> +		execute([]string{"./ubuntu-device-flash", "--verbose", "core", "--output=/tmp/snappy.img", "--developer-mode"})

what's execute? where is it defined?

> +		fmt.Println("HELLO")

is this print for debugging?

> +		return
> +	}
> +
> +	cmd := exec.Command(os.Args[0], "-gocheck.f", "ParserTestSuite.TestExitStatusOnBadArgs")

I don't understand why you have to call the same test, instead of just executing the command. But I'm not going to get picky with this, if you like it and works for you, ok.

> +	cmd.Env = append(os.Environ(), "BE_CRASHER=1")
> +	out, err := cmd.CombinedOutput()
> +	e, ok := err.(*exec.ExitError)
> +	c.Assert(ok, Equals, true)
> +	c.Assert(e.Success(), Equals, false)
> +	c.Assert(string(out), Equals, "the required argument `release` was not provided\n")
> +}


-- 
https://code.launchpad.net/~sergiusens/goget-ubuntu-touch/1473333/+merge/277412
Your team Ubuntu Phablet Team is requested to review the proposed merge of lp:~sergiusens/goget-ubuntu-touch/1473333 into lp:goget-ubuntu-touch.



More information about the Ubuntu-reviews mailing list