| Summary: | ptest: run as user | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Juro Bystricky <juro.bystricky> |
| Component: | core | Assignee: | yeoh ee peng <ee.peng.yeoh> |
| Status: | RESOLVED OBSOLETE | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium+ | CC: | bluelightning, meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie, ross.burton, srikanthx.x.bheemanadhuni, stephano |
| Version: | 2.5 | ||
| Target Milestone: | 4.99 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Don't know | |
| Bug Depends on: | |||
| Bug Blocks: | 12230 | ||
Should be easy enough to make the ptest-runner package create a user for ptest execution, the other step would be to make the ptest test case change user first. I added the user in the sudoer list in /etc/sudoers and modify the run-ptest script by adding sudo where ever it requires. and run the ptest-runner with sudo, i haven't see the permission denied error. My question we need to add the user as sudo in the Image? Successfully created the user and add the user in the sudoers list.
blew are my changes
In the file local.conf
add the below line
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "useradd -s /bin/sh -P 'superuser' superuser; \
usermod -aG sudo superuser;"
run the ptest as user if it requires sudo run the ptest as sudo
eg:
run as user: $ ptest-runner acl
run as sudo: $ sudo ptest-runner acl
before running the ptest we need to export the sbin path
$export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
We're now running tests which need a non-root user as specific test users and have established this as our mechanism for handling this (see glib-2.0). |
Running ptest is more-less equivalent to "make check" testing a cross-compiled package on a target platform instead of the build platform. Packages are normally built is user environment, so it make sense to run ptests as user as well. (I believe we run the "official" tests in root environment instead of a user) It stands to reason, the results may vary depending on whether we run ptest as a user or a root. Some tests when ran as root can be quite destructive. Currently this is not defined well, so some (possibly enforced) guidelines should be established, i.e. always run as a user (run-ptest can check for this on a need to bases), and use "sudo" when need to (there may be some packeges that must be tested as root). This would probably require to create a user account as a part of the test image ("tester").