diff --git a/snapdtool/tool_linux.go b/snapdtool/tool_linux.go index b696aa25a2bc..fd0fc6c2093a 100644 --- a/snapdtool/tool_linux.go +++ b/snapdtool/tool_linux.go @@ -211,9 +211,11 @@ func ExecInSnapdOrCoreSnap() { // Is this executable in the core snap too? coreOrSnapdPath := snapdSnap + origin := "snapd from snap" full := filepath.Join(snapdSnap, exe) if !osutil.FileExists(full) { coreOrSnapdPath = coreSnap + origin = "snapd from core" full = filepath.Join(coreSnap, exe) if !osutil.FileExists(full) { return @@ -222,9 +224,10 @@ func ExecInSnapdOrCoreSnap() { // If the core snap doesn't support re-exec or run-from-core then don't do it. if !systemSnapSupportsReExec(coreOrSnapdPath) { + logger.Noticef(">>>>>> %s does not support re-exec", origin) return } - + logger.Noticef(">>>>>>> restarting into %s (%q)", origin, full) logger.Debugf("restarting into %q", full) panic(syscallExec(full, os.Args, os.Environ())) } diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh index 4ae617813cb7..953087d792da 100755 --- a/tests/lib/prepare.sh +++ b/tests/lib/prepare.sh @@ -412,6 +412,29 @@ prepare_classic() { cache_snaps core20 fi + # Install snapd either build by CI or by snapcraft depending on + # TESTS_USE_PREBUILT_SNAPD_SNAP. This makes the default behaviour + # to re-exec to snapd snap instead of snapd in core. Furthermore, + # it prevents snapd from automatically installing snapd snap as + # prerequisite for installing any non-base snap + if snap list snapd ; then + snap snap info snapd + echo "Error: not expecting snapd be be installed" + exit 1 + else + echo ">>>>>> Snapd is not installed" + echo ">>>>>> Building snapd" + build_dir="$WORK_DIR/snapd_snap_for_classic" + rm -rf "$build_dir" + mkdir -p "$build_dir" + build_snapd_snap "$build_dir" + echo ">>>>>> Installing snapd" + snap install "$build_dir/"snapd_*.snap + fi + snap list | grep snapd + + #exit 1 + # now use parameterized core channel (defaults to edge) instead # of a fixed one and close to stable in order to detect defects # earlier