<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12598</bug_id>
          
          <creation_ts>2018-03-12 14:58:56 +0000</creation_ts>
          <short_desc>ptest: run as user</short_desc>
          <delta_ts>2019-06-11 08:48:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          <blocked>12230</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Juro Bystricky">juro.bystricky</reporter>
          <assigned_to name="yeoh ee peng">ee.peng.yeoh</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>srikanthx.x.bheemanadhuni</cc>
    
    <cc>stephano</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>79789</commentid>
    <comment_count>0</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-03-12 14:58:56 +0000</bug_when>
    <thetext>Running ptest is more-less equivalent to &quot;make check&quot; 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 &quot;official&quot; 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 &quot;sudo&quot; 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 (&quot;tester&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79831</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-03-15 08:07:03 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82232</commentid>
    <comment_count>2</comment_count>
    <who name="Srikanth">srikanthx.x.bheemanadhuni</who>
    <bug_when>2018-11-15 03:30:05 +0000</bug_when>
    <thetext>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&apos;t see the permission denied error.

My question we need to add the user as sudo in the Image?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82279</commentid>
    <comment_count>3</comment_count>
    <who name="Srikanth">srikanthx.x.bheemanadhuni</who>
    <bug_when>2018-11-21 03:22:16 +0000</bug_when>
    <thetext>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 += &quot;extrausers&quot;
EXTRA_USERS_PARAMS = &quot;useradd -s /bin/sh -P &apos;superuser&apos; superuser; \
                       usermod  -aG sudo superuser;&quot;

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84138</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-06-11 08:48:11 +0000</bug_when>
    <thetext>We&apos;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).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>