<?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>15241</bug_id>
          
          <creation_ts>2023-10-18 22:15:04 +0000</creation_ts>
          <short_desc>&quot;oe-selftest --newbuilddir&quot; fails when BB_LOGCONFIG contains the old builddir</short_desc>
          <delta_ts>2024-09-12 22:09:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Functional (self) Testing</product>
          <component>oe-selftest</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yoann Congal">yoann.congal</reporter>
          <assigned_to name="Yoann Congal">yoann.congal</assigned_to>
          <cc>quaresma.jose</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>yoann.congal</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>96725</commentid>
    <comment_count>0</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-10-18 22:15:04 +0000</bug_when>
    <thetext>When BB_LOGCONFIG contains a path relative to the build directory (this is the case on the autobuilder), oe-selftest with the --newbuilddir option fails.

This fails:
 $ rm -rf /home/yocon/Documents/projets/yocto/poky/build/build-test &amp;&amp; BB_LOGCONFIG=/home/yocon/Documents/projets/yocto/poky/build/../bitbake/contrib/autobuilderlog.json oe-selftest --newbuilddir /home/yocon/Documents/projets/yocto/poky/build/build-test -r runcmd.RunCmdTests.test_log
2023-10-19 00:01:58,629 - oe-selftest - INFO - Changing cwd to /home/yocon/Documents/projets/yocto/poky/build
2023-10-19 00:01:58,630 - oe-selftest - INFO - Adding layer libraries:
2023-10-19 00:01:58,630 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta/lib
2023-10-19 00:01:58,630 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-yocto-bsp/lib
2023-10-19 00:01:58,630 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-openembedded/meta-oe/lib
2023-10-19 00:01:58,631 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-selftest/lib
2023-10-19 00:01:58,633 - oe-selftest - INFO - Checking base configuration is valid/parsable
NOTE: Starting bitbake server...
2023-10-19 00:02:03,692 - oe-selftest - INFO - Adding: &quot;include selftest.inc&quot; in /home/yocon/Documents/projets/yocto/poky/build/build-test/build-st/conf/local.conf
2023-10-19 00:02:03,693 - oe-selftest - INFO - Adding: &quot;include bblayers.inc&quot; in bblayers.conf
2023-10-19 00:02:03,694 - oe-selftest - INFO - test_log (runcmd.RunCmdTests)
2023-10-19 00:02:03,708 - oe-selftest - INFO -  ... ok
2023-10-19 00:02:08,770 - oe-selftest - INFO - ----------------------------------------------------------------------
2023-10-19 00:02:08,770 - oe-selftest - INFO - Ran 1 test in 8.142s
2023-10-19 00:02:08,771 - oe-selftest - INFO - OK
Traceback (most recent call last):
  File &quot;/home/yocon/Documents/projets/yocto/poky/scripts/oe-selftest&quot;, line 60, in &lt;module&gt;
    ret = main()
  File &quot;/home/yocon/Documents/projets/yocto/poky/scripts/oe-selftest&quot;, line 47, in main
    results = args.func(logger, args)
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/selftest/context.py&quot;, line 440, in run
    rc = self._internal_run(logger, args)
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/selftest/context.py&quot;, line 404, in _internal_run
    configuration = self.get_configuration(args)
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/selftest/context.py&quot;, line 374, in get_configuration
    metadata = metadata_from_bb()
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/utils/metadata.py&quot;, line 27, in metadata_from_bb
    data_dict = get_bb_vars()
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/utils/commands.py&quot;, line 248, in get_bb_vars
    bbenv = get_bb_env(target, postconfig=postconfig)
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/utils/commands.py&quot;, line 244, in get_bb_env
    return bitbake(&quot;-e&quot;, postconfig=postconfig).output
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/utils/commands.py&quot;, line 234, in bitbake
    return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options)
  File &quot;/home/yocon/Documents/projets/yocto/poky/meta/lib/oeqa/utils/commands.py&quot;, line 212, in runCmd
    raise AssertionError(&quot;Command &apos;%s&apos; returned non-zero exit status %d:\n%s&quot; % (command, result.status, exc_output))
AssertionError: Command &apos;bitbake  -e&apos; returned non-zero exit status 1:
Traceback (most recent call last):
  File &quot;/home/yocon/Documents/projets/yocto/poky/bitbake/bin/bitbake&quot;, line 36, in &lt;module&gt;
    sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
  File &quot;/home/yocon/Documents/projets/yocto/poky/bitbake/lib/bb/main.py&quot;, line 404, in bitbake_main
    return ui_module.main(server_connection.connection, server_connection.events,
  File &quot;/home/yocon/Documents/projets/yocto/poky/bitbake/lib/bb/ui/knotty.py&quot;, line 568, in main
    conf = bb.msg.setLoggingConfig(logconfig, logconfigfile)
  File &quot;/home/yocon/Documents/projets/yocto/poky/bitbake/lib/bb/msg.py&quot;, line 301, in setLoggingConfig
    with open(os.path.normpath(userconfigfile), &apos;r&apos;) as f:
FileNotFoundError: [Errno 2] No such file or directory: &apos;/home/yocon/Documents/projets/yocto/poky/build/build-test/bitbake/contrib/autobuilderlog.json&apos;

This succeed:
 $ rm -rf /home/yocon/Documents/projets/yocto/poky/build/build-test &amp;&amp; BB_LOGCONFIG=/home/yocon/Documents/projets/yocto/poky/bitbake/contrib/autobuilderlog.json oe-selftest --newbuilddir /home/yocon/Documents/projets/yocto/poky/build/build-test -r runcmd.RunCmdTests.test_log
2023-10-19 00:02:45,342 - oe-selftest - INFO - Changing cwd to /home/yocon/Documents/projets/yocto/poky/build
2023-10-19 00:02:45,343 - oe-selftest - INFO - Adding layer libraries:
2023-10-19 00:02:45,343 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta/lib
2023-10-19 00:02:45,343 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-yocto-bsp/lib
2023-10-19 00:02:45,343 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-openembedded/meta-oe/lib
2023-10-19 00:02:45,344 - oe-selftest - INFO - 	/home/yocon/Documents/projets/yocto/poky/meta-selftest/lib
2023-10-19 00:02:45,346 - oe-selftest - INFO - Checking base configuration is valid/parsable
NOTE: Starting bitbake server...
2023-10-19 00:02:50,610 - oe-selftest - INFO - Adding: &quot;include selftest.inc&quot; in /home/yocon/Documents/projets/yocto/poky/build/build-test/build-st/conf/local.conf
2023-10-19 00:02:50,610 - oe-selftest - INFO - Adding: &quot;include bblayers.inc&quot; in bblayers.conf
2023-10-19 00:02:50,611 - oe-selftest - INFO - test_log (runcmd.RunCmdTests)
2023-10-19 00:02:50,626 - oe-selftest - INFO -  ... ok
2023-10-19 00:02:55,693 - oe-selftest - INFO - ----------------------------------------------------------------------
2023-10-19 00:02:55,694 - oe-selftest - INFO - Ran 1 test in 8.191s
2023-10-19 00:02:55,694 - oe-selftest - INFO - OK
2023-10-19 00:03:09,852 - oe-selftest - INFO - RESULTS:
2023-10-19 00:03:09,853 - oe-selftest - INFO - RESULTS - runcmd.RunCmdTests.test_log: PASSED (0.02s)
2023-10-19 00:03:09,857 - oe-selftest - INFO - SUMMARY:
2023-10-19 00:03:09,857 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 8.193s
2023-10-19 00:03:09,857 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)


Note the difference in BB_LOGCONFIG:
FAIL: /home/yocon/Documents/projets/yocto/poky/build/../bitbake/contrib/autobuilderlog.json
PASS: /home/yocon/Documents/projets/yocto/poky/bitbake/contrib/autobuilderlog.json

My hypothesis is that oe-selftest --newbuilddir tries to rewrite paths from the old builddir to the newly created one, and, doing so rewrite the path for the autobuilderlog.json file to a non-existing path.
One workaround in the autobuilder case: Use &quot;readlink -f&quot; to make the path of BB_LOGCONFIG absolute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96726</commentid>
    <comment_count>1</comment_count>
    <who name="Jose Quaresma">quaresma.jose</who>
    <bug_when>2023-10-18 23:18:10 +0000</bug_when>
    <thetext>I have found the same for BBLAYERS that was fixed [1] expanding any relative path that could exist.

[1] https://git.yoctoproject.org/poky/commit/?id=f5f465ff5777eb99941db3dda84e65d4699d97f7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96727</commentid>
    <comment_count>2</comment_count>
    <who name="Jose Quaresma">quaresma.jose</who>
    <bug_when>2023-10-18 23:22:59 +0000</bug_when>
    <thetext>Maybe it would be better to also expand BB_LOGCONFIG when the newbuilddir argument is present.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96738</commentid>
    <comment_count>3</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-10-19 14:40:36 +0000</bug_when>
    <thetext>NB: https://git.yoctoproject.org/yocto-autobuilder-helper/commit/?id=6f48f65c682c2ec076f926891a98913fb09647d4 does contain a workaround this bug (but should not be fully reversed, I did put 2 things in my patch -_-&apos;)
=&gt; Once this bug is fixed, the workaround should be removed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97618</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-12-19 07:00:58 +0000</bug_when>
    <thetext>Bumping target milestone to 5.0 M2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97955</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-01-23 14:39:29 +0000</bug_when>
    <thetext>Bulk move to Milestone 5.0 M3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98269</commentid>
    <comment_count>6</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-02-22 16:23:32 +0000</bug_when>
    <thetext>Bulk move to 5.0 M4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99640</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-09-10 20:51:17 +0000</bug_when>
    <thetext>Patch sent : https://lists.openembedded.org/g/openembedded-core/message/204370</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99659</commentid>
    <comment_count>8</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-09-12 15:26:00 +0000</bug_when>
    <thetext>Merged https://git.openembedded.org/openembedded-core/commit/?h=master&amp;id=c5e70500caffcd0518899cc6eba23a38bc3be108</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99660</commentid>
    <comment_count>9</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-09-12 17:02:54 +0000</bug_when>
    <thetext>(In reply to Yoann Congal from comment #3)
&gt; NB:
&gt; https://git.yoctoproject.org/yocto-autobuilder-helper/commit/
&gt; ?id=6f48f65c682c2ec076f926891a98913fb09647d4 does contain a workaround this
&gt; bug (but should not be fully reversed, I did put 2 things in my patch -_-&apos;)
&gt; =&gt; Once this bug is fixed, the workaround should be removed

Workaround removal sent: https://lists.yoctoproject.org/g/yocto-patches/message/650</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99665</commentid>
    <comment_count>10</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-09-12 22:09:16 +0000</bug_when>
    <thetext>(In reply to Yoann Congal from comment #9)
&gt; Workaround removal sent:
&gt; https://lists.yoctoproject.org/g/yocto-patches/message/650

merged https://git.yoctoproject.org/yocto-autobuilder-helper/commit/?id=3278a99ea0df1dd75402383bad2fbf073bf8efcc</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>