Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sefltest: advise reboot into 4.4 on trusty running 3.13
This patch extends the self-test system to check if a user running Ubuntu 14.04 has just installed snapd and is still running the 3.13 kernel that is used by trusty by default. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
- Loading branch information
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// -*- Mode: Go; indent-tabs-mode: t -*- | ||
|
||
/* | ||
* Copyright (C) 2018 Canonical Ltd | ||
* | ||
* 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 warranty of | ||
* MERCHANTABILITY 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/>. | ||
* | ||
*/ | ||
|
||
package selftest | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/snapcore/snapd/release" | ||
"github.com/snapcore/snapd/strutil" | ||
) | ||
|
||
// checkKernelVersion looks for some unsupported configurations that users may | ||
// encounter and provides advice on how to resolve them. | ||
func checkKernelVersion() error { | ||
if release.OnClassic && release.ReleaseInfo.ID == "ubuntu" && release.ReleaseInfo.VersionID == "14.04" { | ||
if cmp, _ := strutil.VersionCompare(release.KernelVersion(), "3.13"); cmp <= 0 { | ||
return fmt.Errorf("you need to reboot into a 4.4 kernel to start using snapd") | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// -*- Mode: Go; indent-tabs-mode: t -*- | ||
|
||
/* | ||
* Copyright (C) 2018 Canonical Ltd | ||
* | ||
* 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 warranty of | ||
* MERCHANTABILITY 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/>. | ||
* | ||
*/ | ||
|
||
package selftest_test | ||
|
||
import ( | ||
. "gopkg.in/check.v1" | ||
|
||
"github.com/snapcore/snapd/release" | ||
"github.com/snapcore/snapd/selftest" | ||
) | ||
|
||
type versionSuite struct{} | ||
|
||
var _ = Suite(&versionSuite{}) | ||
|
||
func (s *selftestSuite) TestFreshInstallOfSnapdOnTrusty(c *C) { | ||
// Mock an Ubuntu 14.04 system running a 3.13 kernel | ||
restore := release.MockOnClassic(true) | ||
defer restore() | ||
restore = release.MockReleaseInfo(&release.OS{ID: "ubuntu", VersionID: "14.04"}) | ||
defer restore() | ||
restore = release.MockKernelVersion("3.13.0-35-generic") | ||
defer restore() | ||
|
||
// Check for the given advice. | ||
err := selftest.CheckKernelVersion() | ||
c.Assert(err, ErrorMatches, "you need to reboot into a 4.4 kernel to start using snapd") | ||
} |