Bug 11524 - Runtime testing using Systemd-bootTarget is not working
Summary: Runtime testing using Systemd-bootTarget is not working
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.4.2
Assignee: Stephano Cetola
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-05-18 08:14 UTC by Erik Botö
Modified: 2018-01-17 05:24 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Botö 2017-05-18 08:14:01 UTC
I've tried to follow the documentation from http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#performing-automated-runtime-testing in order to setup a Intel NUC with core-image-testmaster, and then use bitbake -c testimage core-image-sato in order to run the tests.

I didn't understand how to use the installer parts of core-image-testmaster-initrd, so I deployed it manually by setting up the partition scheme according to the docs and manually creating /etc/masterimage.

But when I then run 'bitbake -c testimage core-image-sato' it fails with the following error:

core-image-sato-1.0-r0 do_testimage: core-image-sato - deploying image on target
ERROR: core-image-sato-1.0-r0 do_testimage: Failed deploying test image: Command '['ssh', '-l', 'root', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-o', 'LogLevel=ERROR', '172.31.173.107', 'export PATH=/usr/sbin:/sbin:/usr/bin:/bin; cp ~/test-kernel /boot']' returned non-zero exit status 1:
cp: cannot stat '/home/root/test-kernel': No such file or directory

Looking at the core-image-testmaster instance I see that deploy step has managed to create some symlinks, but never actually copied the actual artifacts those symlinks points to:

lrwxrwxrwx 1 root root 80 May 18 05:57 test-kernel -> bzImage--4.8.17+git0+bb6984f46b_9bcb4ea3fa-r0-intel-corei7-64-20170517060056.bin
lrwxrwxrwx 1 root root 60 May 18 05:57 test-rootfs.tar.gz -> core-image-sato-intel-corei7-64-20170517133030.rootfs.tar.gz

Inspecting the code I found this definition of copy_to in lib/oeqa/utils/sshcontrol.py:

    def copy_to(self, localpath, remotepath):
        if os.path.islink(localpath):
            link = os.readlink(localpath)
            dst_dir, dst_base = os.path.split(remotepath)
            return self.run("cd %s; ln -s %s %s" % (dst_dir, link, dst_base))
        else:
            command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
            return self._internal_run(command, ignore_status=False)

Since the arguments passed to this is functions are symlinks (in my case tmp/deploy/images/intel-corei7-64/core-image-sato-intel-corei7-64.tar.gz which is a symlink to tmp/deploy/images/intel-corei7-64/core-image-sato-intel-corei7-64-20170517133030.rootfs.tar.gz) it just created a dead symlink instead of scp:ing the file. 

Why is this if/else needed? Does it matter that the input is a symlink? The scp command can still be executed with the symlink as input.

I would be happy to work on a patch if I can get in contact with someone who can review it so I don't miss the "big picture".
Comment 2 Stephano Cetola 2017-07-26 20:42:49 UTC
The patches have been submitted. I believe this is waiting on a sign off from some in QA to confirm that this fix is appropriate. I'm not sure who that should be though. 

Adding Leo to CC. Let me know who can help with this one.
Comment 3 Stephano Cetola 2017-09-28 19:47:23 UTC
Sorry this got lost in the 2.4 shuffle. 

I spoke with Jair and Leo. They both think this patch is still relevant and that it looks good.

I'll resubmit this and CC the correct people so that it gets into 2.5M1.
Comment 5 Stephano Cetola 2017-11-09 16:50:34 UTC
This is now in oe-core:

a9c7f877e5bda32249755dc7014d436e4b85f07a
adfe79dee90b6e080b97869444882b84468d49ba
64614ab6894143fa4876558cbe3d2954e5b08eac
1eb2a9c2f48d3af13ce651f1adf024b3380299d1

Backporting to 2.4 now.
Comment 6 Stephano Cetola 2017-11-12 17:33:08 UTC
https://patchwork.openembedded.org/series/9690/
Comment 7 Stephano Cetola 2018-01-17 05:24:29 UTC
Merged in the following commits:

a9d446d9c42a67109ae87a156ae43dcbb0f56e1e
4e376d0658fe8315cfcca927ea275e1260bcc02f
1871d61b75f2fbc0df1368960b7746371fd875f5
6f5c4a8e07f8cdf3f6352e9e85d7376937bb32d2