diff mbox series

[v3,1/7] rust: Fetch cargo from rust-snapshot dir.

Message ID 20240123131633.641012-1-Yash.Shinde@windriver.com
State Accepted, archived
Commit 1a048b5ab7f891911beaa14eb9269033c84088dc
Headers show
Series [v3,1/7] rust: Fetch cargo from rust-snapshot dir. | expand

Commit Message

Yash Shinde Jan. 23, 2024, 1:16 p.m. UTC
From: Yash Shinde <Yash.Shinde@windriver.com>

    Fixes: Exception: no cargo executable found at
           `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`

    Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.

    Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
 .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch

Comments

Richard Purdie Jan. 23, 2024, 8:07 p.m. UTC | #1
On Tue, 2024-01-23 at 05:16 -0800, Shinde, Yash via
lists.openembedded.org wrote:
> From: Yash Shinde <Yash.Shinde@windriver.com>
> 
>     Fixes: Exception: no cargo executable found at
>            `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
> 
>     Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.
> 
>     Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125
> 
> Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
> ---
>  .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch

Unlike earlier versions of this series, there were a lot of failures:

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6482

Basically every machine except qemumips failed on the toolchain tests.

Cheers,

Richard
Richard Purdie Jan. 23, 2024, 9:17 p.m. UTC | #2
On Tue, 2024-01-23 at 20:07 +0000, Richard Purdie via
lists.openembedded.org wrote:
> On Tue, 2024-01-23 at 05:16 -0800, Shinde, Yash via
> lists.openembedded.org wrote:
> > From: Yash Shinde <Yash.Shinde@windriver.com>
> > 
> >     Fixes: Exception: no cargo executable found at
> >            `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
> > 
> >     Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.
> > 
> >     Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125
> > 
> > Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
> > ---
> >  .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
> >  1 file changed, 37 insertions(+)
> >  create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch
> 
> Unlike earlier versions of this series, there were a lot of failures:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6482
> 
> Basically every machine except qemumips failed on the toolchain tests.

I also meant to mention, we need to improve the test output when it
fails. It is currently near useless :(

Cheers,

Richard
Yash Shinde Jan. 24, 2024, 6:48 a.m. UTC | #3
On 24-01-2024 01:37, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, 2024-01-23 at 05:16 -0800, Shinde, Yash via
> lists.openembedded.org wrote:
>> From: Yash Shinde <Yash.Shinde@windriver.com>
>>
>>      Fixes: Exception: no cargo executable found at
>>             `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
>>
>>      Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.
>>
>>      Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125
>>
>> Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
>> ---
>>   .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
>>   1 file changed, 37 insertions(+)
>>   create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch
> Unlike earlier versions of this series, there were a lot of failures:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6482
>
> Basically every machine except qemumips failed on the toolchain tests.

I investigated and found the cause of the failures.

Actually, some test cases were additionally missed while removing them 
from exclude list when
making changes for "rust: Remove the test cases whose parent dir is also 
present in the exclude list" patch.
(Maybe, the automated tool used to remove tests didn't work properly...)

I fixed those and after successful tests, I will send the patch.

Regards,
Yash

>
> Cheers,
>
> Richard
Yash Shinde Jan. 24, 2024, 6:50 a.m. UTC | #4
On 24-01-2024 02:47, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, 2024-01-23 at 20:07 +0000, Richard Purdie via
> lists.openembedded.org wrote:
>> On Tue, 2024-01-23 at 05:16 -0800, Shinde, Yash via
>> lists.openembedded.org wrote:
>>> From: Yash Shinde<Yash.Shinde@windriver.com>
>>>
>>>      Fixes: Exception: no cargo executable found at
>>>             `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
>>>
>>>      Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.
>>>
>>>      Patch sent to upstream-https://github.com/rust-lang/rust/pull/120125
>>>
>>> Signed-off-by: Yash Shinde<Yash.Shinde@windriver.com>
>>> ---
>>>   .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
>>>   1 file changed, 37 insertions(+)
>>>   create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch
>> Unlike earlier versions of this series, there were a lot of failures:
>>
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6482
>>
>> Basically every machine except qemumips failed on the toolchain tests.
> I also meant to mention, we need to improve the test output when it
> fails. It is currently near useless :(

The test output log is redirected to '${B}/rustc-1.74.1-src/summary.txt' 
file which has
test results and error logs for failed test cases, if any.

I assume you are asking for more details in the cmd window of oe-selftest?

$ oe-selftest -r rust

cmdline output:
/
/

/2024-01-23 20:08:39,227 - oe-selftest - INFO - Changing cwd to 
/home/poky/build
2024-01-23 20:08:39,228 - oe-selftest - INFO - Adding layer libraries:
2024-01-23 20:08:39,228 - oe-selftest - INFO - /home/poky/meta/lib
2024-01-23 20:08:39,228 - oe-selftest - INFO - /home/poky/meta-yocto-bsp/lib
2024-01-23 20:08:39,228 - oe-selftest - INFO - /home/poky/meta-selftest/lib
2024-01-23 20:08:39,229 - oe-selftest - INFO - Checking base 
configuration is valid/parsable
2024-01-23 20:08:40,757 - oe-selftest - INFO - Adding: "include 
selftest.inc" in /home/poky/build-st/conf/local.conf
2024-01-23 20:08:40,757 - oe-selftest - INFO - Adding: "include 
bblayers.inc" in bblayers.conf
2024-01-23 20:08:40,758 - oe-selftest - INFO - test_rust 
(rust.RustSelfTestSystemEmulated)
2024-01-23 21:22:50,600 - oe-selftest - INFO -  ... ok
2024-01-23 21:22:50,622 - oe-selftest - INFO - 
----------------------------------------------------------------------
2024-01-23 21:22:50,622 - oe-selftest - INFO - Ran 1 test in 4450.264s
2024-01-23 21:22:50,622 - oe-selftest - INFO - OK
2024-01-23 21:23:08,292 - oe-selftest - INFO - RESULTS:
2024-01-23 21:23:08,292 - oe-selftest - INFO - RESULTS - 
rust.RustSelfTestSystemEmulated.test_rust: PASSED (4449.86s)
2024-01-23 21:23:08,477 - oe-selftest - INFO - SUMMARY:
2024-01-23 21:23:08,478 - oe-selftest - INFO - oe-selftest () - Ran 1 
test in 4450.264s
2024-01-23 21:23:08,478 - oe-selftest - INFO - oe-selftest - OK - All 
required tests passed (successes=1, skipped=0, failures=0, errors=0)
/
Currently, it shows above info which is similar to other toolchain 
oe-selftests.
Let me know how the output log should look like?


Regards,
Yash

> Cheers,
>
> Richard
Richard Purdie Jan. 24, 2024, 10:21 a.m. UTC | #5
On Wed, 2024-01-24 at 12:20 +0530, Yash Shinde wrote:
>  On 24-01-2024 02:47, Richard Purdie wrote:
>  CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > On Tue, 2024-01-23 at 20:07 +0000, Richard Purdie via
> > lists.openembedded.org wrote:
> >  
> > > On Tue, 2024-01-23 at 05:16 -0800, Shinde, Yash via
> > > lists.openembedded.org wrote:
> > >  
> > > > 
> > > > From: Yash Shinde <Yash.Shinde@windriver.com>
> > > > 
> > > >     Fixes: Exception: no cargo executable found at
> > > >            `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
> > > > 
> > > >     Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.
> > > > 
> > > >     Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125
> > > > 
> > > > Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
> > > > ---
> > > >  .../rust/files/cargo-path.patch               | 37 +++++++++++++++++++
> > > >  1 file changed, 37 insertions(+)
> > > >  create mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch
> > > >  
> > > Unlike earlier versions of this series, there were a lot of failures:
> > > 
> > > https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6482
> > > 
> > > Basically every machine except qemumips failed on the toolchain tests.
> > >  
> > I also meant to mention, we need to improve the test output when it
> > fails. It is currently near useless :(
> >  
> 
> The test output log is redirected to '${B}/rustc-1.74.1-src/summary.txt' file which has 
>  test results and error logs for failed test cases, if any.
>  
> 
>  I assume you are asking for more details in the cmd window of oe-selftest?
>  
>  $ oe-selftest -r rust
>   cmdline output:
>  
> 2024-01-23 20:08:39,227 - oe-selftest - INFO - Changing cwd to /home/poky/build
>  2024-01-23 20:08:39,228 - oe-selftest - INFO - Adding layer libraries:
>  2024-01-23 20:08:39,228 - oe-selftest - INFO -  /home/poky/meta/lib
>  2024-01-23 20:08:39,228 - oe-selftest - INFO -  /home/poky/meta-yocto-bsp/lib
>  2024-01-23 20:08:39,228 - oe-selftest - INFO -  /home/poky/meta-selftest/lib
>  2024-01-23 20:08:39,229 - oe-selftest - INFO - Checking base configuration is valid/parsable
>  2024-01-23 20:08:40,757 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/poky/build-st/conf/local.conf
>  2024-01-23 20:08:40,757 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
>  2024-01-23 20:08:40,758 - oe-selftest - INFO - test_rust (rust.RustSelfTestSystemEmulated)
>  2024-01-23 21:22:50,600 - oe-selftest - INFO -  ... ok
>  2024-01-23 21:22:50,622 - oe-selftest - INFO - ----------------------------------------------------------------------
>  2024-01-23 21:22:50,622 - oe-selftest - INFO - Ran 1 test in 4450.264s
>  2024-01-23 21:22:50,622 - oe-selftest - INFO - OK
>  2024-01-23 21:23:08,292 - oe-selftest - INFO - RESULTS:
>  2024-01-23 21:23:08,292 - oe-selftest - INFO - RESULTS - rust.RustSelfTestSystemEmulated.test_rust: PASSED (4449.86s)
>  2024-01-23 21:23:08,477 - oe-selftest - INFO - SUMMARY:
>  2024-01-23 21:23:08,478 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 4450.264s
>  2024-01-23 21:23:08,478 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)
>  
> 
> 
> 
>  Currently, it shows above info which is similar to other toolchain oe-selftests.
>  Let me know how the output log should look like?
>  

When it passes, this output is fine, we don't need to know the details.
The issue is that when it fails, we can't see why it fails since the
output is buried in summary.txt.

I'm therefore asking when it fails, we see the output in summary.txt
but only when it fails.

I think if you remove the redirection to a file it should work since
selftest only displays the output upon failure.

Cheers,

RIchard
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/files/cargo-path.patch b/meta/recipes-devtools/rust/files/cargo-path.patch
new file mode 100644
index 0000000000..547df353d2
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/cargo-path.patch
@@ -0,0 +1,37 @@ 
+Fix the cargo binary path error and ensure that it is fetched 
+during rustc bootstrap in rust oe-selftest. 
+
+======================================================================
+ERROR: test_cargoflags (bootstrap_test.BuildBootstrap)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 157, in test_cargoflags
+    args, _ = self.build_args(env={"CARGOFLAGS": "--timings"})
+  File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 154, in build_args
+    return build.build_bootstrap_cmd(env), env
+  File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap.py", line 960, in build_bootstrap_cmd
+    raise Exception("no cargo executable found at `{}`".format(
+Exception: no cargo executable found at `/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
+
+Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/120125]
+
+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
+---
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -954,9 +954,11 @@
+         if deny_warnings:
+             env["RUSTFLAGS"] += " -Dwarnings"
+
+-        env["PATH"] = os.path.join(self.bin_root(), "bin") + \
+-            os.pathsep + env["PATH"]
+-        if not os.path.isfile(self.cargo()):
++        cargo_bin_path = os.path.join(self.bin_root(), "bin", "cargo")
++        if not os.path.isfile(cargo_bin_path):
++            cargo_bin_path = os.getenv("RUST_TARGET_PATH") + "rust-snapshot/bin/cargo"
++            env["PATH"] = os.path.dirname(cargo_bin_path) + os.pathsep + env["PATH"]
++        else:
+             raise Exception("no cargo executable found at `{}`".format(
+                 self.cargo()))
+         args = [self.cargo(), "build", "--manifest-path",