Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Rust runtime tests issues
@ 2018-04-17 13:06 Thomas Petazzoni
  2018-04-18 10:17 ` Eric Le Bihan
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-04-17 13:06 UTC (permalink / raw)
  To: buildroot

Eric, Charles,

The Rust tests in support/testing/ are consistently failing:

  https://gitlab.com/buildroot.org/buildroot/-/jobs/63334941
  https://gitlab.com/buildroot.org/buildroot/-/jobs/63334942

Do you think you could have a look, and see what's not working, and fix
those tests ?

Thanks a lot,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] Rust runtime tests issues
  2018-04-17 13:06 [Buildroot] Rust runtime tests issues Thomas Petazzoni
@ 2018-04-18 10:17 ` Eric Le Bihan
  2018-04-24 21:37   ` Eric Le Bihan
  2018-04-25 21:22   ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Le Bihan @ 2018-04-18 10:17 UTC (permalink / raw)
  To: buildroot

Hi!

> The Rust tests in support/testing/ are consistently failing:
> 
>   https://gitlab.com/buildroot.org/buildroot/-/jobs/63334941
>   https://gitlab.com/buildroot.org/buildroot/-/jobs/63334942
> 
> Do you think you could have a look, and see what's not working, and fix
> those tests ?

The build 63334942 fails as follow:

======================================================================
ERROR: test_run (tests.package.test_rust.TestRustBin)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builds/buildroot.org/buildroot/support/testing/tests/package/test_rust.py", line 80, in test_run
    self.build_test_prog()
  File "/builds/buildroot.org/buildroot/support/testing/tests/package/test_rust.py", line 39, in build_test_prog
    raise SystemError("Cargo init failed")
SystemError: Cargo init failed```
```

The exception is raised because the execution of the command to 
create a dummy test program "hello-world", with the previously built
version of host-cargo, fails.

From the file TestRustBin-build.log found in the artifacts.zip of job
63334942, we can see:

```
error: Failed to create project `hello-world` at `/tmp/tmpOEzb1U-br2-testing-rust/hello-world`                                                                                                 
                                                                                                                                                                                               
Caused by:                                                                                                                                                                                     
  could not determine the current user, please set $USER 
```

As the run-time test on CI apparently runs through Docker, should some setup 
related to $USER be added to it?

--
ELB

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] Rust runtime tests issues
  2018-04-18 10:17 ` Eric Le Bihan
@ 2018-04-24 21:37   ` Eric Le Bihan
  2018-04-25 21:22   ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Le Bihan @ 2018-04-24 21:37 UTC (permalink / raw)
  To: buildroot

On 2018-04-18 12:17, Eric Le Bihan wrote:
> Hi!
>
> > The Rust tests in support/testing/ are consistently failing:
> >
> >   https://gitlab.com/buildroot.org/buildroot/-/jobs/63334941
> >   https://gitlab.com/buildroot.org/buildroot/-/jobs/63334942
> >
> > Do you think you could have a look, and see what's not working, and fix
> > those tests ?
>
> The build 63334942 fails as follow:
>
> ======================================================================
> ERROR: test_run (tests.package.test_rust.TestRustBin)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/builds/buildroot.org/buildroot/support/testing/tests/package/test_rust.py", line 80, in test_run
>     self.build_test_prog()
>   File "/builds/buildroot.org/buildroot/support/testing/tests/package/test_rust.py", line 39, in build_test_prog
>     raise SystemError("Cargo init failed")
> SystemError: Cargo init failed```
> ```
>
> The exception is raised because the execution of the command to
> create a dummy test program "hello-world", with the previously built
> version of host-cargo, fails.
>
> From the file TestRustBin-build.log found in the artifacts.zip of job
> 63334942, we can see:
>
> ```
> error: Failed to create project `hello-world` at `/tmp/tmpOEzb1U-br2-testing-rust/hello-world`
>
> Caused by:
>   could not determine the current user, please set $USER
> ```
>
> As the run-time test on CI apparently runs through Docker, should some setup
> related to $USER be added to it?

I built the Docker image using support/docker/Dockerfile.

Running 'docker run buildroot printenv' shows that only $HOME is
defined. To define $USER to br-user and make cargo happy, should Docker
be invoked with "-e USER=br-user" or should it be best to patch
support/testing/tests/package/test_rust.py to add it to the environment
when calling subprocess.call()?

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] Rust runtime tests issues
  2018-04-18 10:17 ` Eric Le Bihan
  2018-04-24 21:37   ` Eric Le Bihan
@ 2018-04-25 21:22   ` Thomas Petazzoni
  2018-04-26  6:02     ` Eric Le Bihan
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-04-25 21:22 UTC (permalink / raw)
  To: buildroot

Hello Eric,

On Wed, 18 Apr 2018 12:17:36 +0200 (CEST), Eric Le Bihan wrote:

> The exception is raised because the execution of the command to 
> create a dummy test program "hello-world", with the previously built
> version of host-cargo, fails.
> 
> From the file TestRustBin-build.log found in the artifacts.zip of job
> 63334942, we can see:
> 
> ```
> error: Failed to create project `hello-world` at `/tmp/tmpOEzb1U-br2-testing-rust/hello-world`                                                                                                 
>                                                                                                                                                                                                
> Caused by:                                                                                                                                                                                     
>   could not determine the current user, please set $USER 
> ```
> 
> As the run-time test on CI apparently runs through Docker, should some setup 
> related to $USER be added to it?

Why does it need to have a USER variable defined ? It seems weird to
require details about the user running the build. The code seems to do
this:

fn discover_author() -> CargoResult<(String, Option<String>)> {
    let cwd = env::current_dir()?;
    let git_config = if let Ok(repo) = GitRepository::discover(&cwd) {
        repo.config().ok().or_else(|| GitConfig::open_default().ok())
    } else {
        GitConfig::open_default().ok()
    };
    let git_config = git_config.as_ref();
    let name_variables = ["CARGO_NAME", "GIT_AUTHOR_NAME", "GIT_COMMITTER_NAME",
                         "USER", "USERNAME", "NAME"];
    let name = get_environment_variable(&name_variables[0..3])
                        .or_else(|| git_config.and_then(|g| g.get_string("user.name").ok()))
                        .or_else(|| get_environment_variable(&name_variables[3..]));

    let name = match name {
        Some(name) => name,
        None => {
            let username_var = if cfg!(windows) {"USERNAME"} else {"USER"};
            bail!("could not determine the current user, please set ${}",
                  username_var)
        }
    };
    let email_variables = ["CARGO_EMAIL", "GIT_AUTHOR_EMAIL", "GIT_COMMITTER_EMAIL",
                          "EMAIL"];
    let email = get_environment_variable(&email_variables[0..3])
                          .or_else(|| git_config.and_then(|g| g.get_string("user.email").ok()))
                          .or_else(|| get_environment_variable(&email_variables[3..]));

    let name = name.trim().to_string();
    let email = email.map(|s| s.trim().to_string());

    Ok((name, email))
}

Should we set CARGO_NAME and CARGO_EMAIL ? Only when building cargo ?
Everytime cargo is used ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] Rust runtime tests issues
  2018-04-25 21:22   ` Thomas Petazzoni
@ 2018-04-26  6:02     ` Eric Le Bihan
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Le Bihan @ 2018-04-26  6:02 UTC (permalink / raw)
  To: buildroot

On 2018-04-25 23:22, Thomas Petazzoni wrote:
> Hello Eric,
>
> On Wed, 18 Apr 2018 12:17:36 +0200 (CEST), Eric Le Bihan wrote:
>
> > The exception is raised because the execution of the command to
> > create a dummy test program "hello-world", with the previously built
> > version of host-cargo, fails.
> >
> > From the file TestRustBin-build.log found in the artifacts.zip of job
> > 63334942, we can see:
> >
> > ```
> > error: Failed to create project `hello-world` at `/tmp/tmpOEzb1U-br2-testing-rust/hello-world`
> >
> > Caused by:
> >   could not determine the current user, please set $USER
> > ```
> >
> > As the run-time test on CI apparently runs through Docker, should some setup
> > related to $USER be added to it?
>
> Why does it need to have a USER variable defined ? It seems weird to
> require details about the user running the build. The code seems to do
> this:
>
> fn discover_author() -> CargoResult<(String, Option<String>)> {
>     let cwd = env::current_dir()?;
>     let git_config = if let Ok(repo) = GitRepository::discover(&cwd) {
>         repo.config().ok().or_else(|| GitConfig::open_default().ok())
>     } else {
>         GitConfig::open_default().ok()
>     };
>     let git_config = git_config.as_ref();
>     let name_variables = ["CARGO_NAME", "GIT_AUTHOR_NAME", "GIT_COMMITTER_NAME",
>                          "USER", "USERNAME", "NAME"];
>     let name = get_environment_variable(&name_variables[0..3])
>                         .or_else(|| git_config.and_then(|g| g.get_string("user.name").ok()))
>                         .or_else(|| get_environment_variable(&name_variables[3..]));
>
>     let name = match name {
>         Some(name) => name,
>         None => {
>             let username_var = if cfg!(windows) {"USERNAME"} else {"USER"};
>             bail!("could not determine the current user, please set ${}",
>                   username_var)
>         }
>     };
>     let email_variables = ["CARGO_EMAIL", "GIT_AUTHOR_EMAIL", "GIT_COMMITTER_EMAIL",
>                           "EMAIL"];
>     let email = get_environment_variable(&email_variables[0..3])
>                           .or_else(|| git_config.and_then(|g| g.get_string("user.email").ok()))
>                           .or_else(|| get_environment_variable(&email_variables[3..]));
>
>     let name = name.trim().to_string();
>     let email = email.map(|s| s.trim().to_string());
>
>     Ok((name, email))
> }
>
> Should we set CARGO_NAME and CARGO_EMAIL ? Only when building cargo ?
> Everytime cargo is used ?

The error message comes from "src/cargo/ops/cargo_new.rs", so this means
it is raised when invoking 'cargo init' in the test script to create
the dummy test program.

There should be no need to set these environment variables everytime
cargo is used, only when creating a new project using 'cargo init/new',
which should most of the time be run by a human and not by Buildroot.

Adding 'env["USER"] = "br-user"' to TestRustBase.build_test_prog() should
do the trick.

I'll send a patch.

Thanks for the hint.

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-26  6:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-17 13:06 [Buildroot] Rust runtime tests issues Thomas Petazzoni
2018-04-18 10:17 ` Eric Le Bihan
2018-04-24 21:37   ` Eric Le Bihan
2018-04-25 21:22   ` Thomas Petazzoni
2018-04-26  6:02     ` Eric Le Bihan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox