Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SGX target: fix std unit tests #59136

Merged
merged 1 commit into from
Mar 26, 2019
Merged

Conversation

jethrogb
Copy link
Contributor

This fixes some tests and some code in the SGX sys implementation to make the std unit test suite pass.

#59009 must be merged first.

@rust-highfive
Copy link
Collaborator

r? @KodrAus

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 12, 2019
@jethrogb
Copy link
Contributor Author

These tests currently fail:

  • time::tests::since_epoch
  • time::tests::system_time_math

I'm still investigating whether this is a bug in the SGX sys implemenation, or a bug in the tests. The cause is that the SGX SystemTime (and CloudABI, WASM) only support the year range 1970..2554. See https://internals.rust-lang.org/t/restrictions-on-std-systemtime/9595/4

@jethrogb jethrogb force-pushed the jb/sgx-std-test branch 2 times, most recently from 3c387cb to 33b41b7 Compare March 12, 2019 22:11
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:073951a1:start=1552428803043249715,finish=1552428907796507733,duration=104753258018
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---

[00:03:55] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:55] tidy error: /checkout/src/libstd/net/tcp.rs:1380: line longer than 100 chars
[00:03:55] tidy error: /checkout/src/libstd/net/tcp.rs:1401: line longer than 100 chars
[00:03:56] tidy error: /checkout/src/libstd/net/test.rs:39: platform-specific cfg: cfg!(target_env = "sgx")
[00:03:57] some tidy checks failed
[00:03:57] 
[00:03:57] 
[00:03:57] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:57] 
[00:03:57] 
[00:03:57] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:57] Build completed unsuccessfully in 0:00:47
[00:03:57] Build completed unsuccessfully in 0:00:47
[00:03:57] make: *** [tidy] Error 1
[00:03:57] Makefile:68: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1307b9d2
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Mar 12 22:19:13 UTC 2019
---
travis_time:end:076b0c20:start=1552429154476013001,finish=1552429154480953920,duration=4940919
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0ab5b70d
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:12ee7d66
travis_time:start:12ee7d66
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0b029728
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@jethrogb
Copy link
Contributor Author

These tests currently fail:

  • time::tests::since_epoch
  • time::tests::system_time_math

These last two tests are addressed in #59147

@bors
Copy link
Contributor

bors commented Mar 16, 2019

☔ The latest upstream changes (presumably #59226) made this pull request unmergeable. Please resolve the merge conflicts.

@@ -3801,7 +3801,7 @@ mod tests {
});
);

if cfg!(unix) {
if cfg!(unix) || cfg!(all(target_env = "sgx", target_vendor = "fortanix")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me all other places check target_env, but only in this file target_vendor too is checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other places where target_vendor is used already, like https://github.com/rust-lang/rust/blob/master/src/libstd/sys_common/mod.rs#L54

I choose all(target_vendor = "fortanix", target_env = "sgx") or target_env = "sgx" on a best-effort basis depending on the particular functionality. However, since there are no upstream targets that are all(not(target_vendor = "fortanix"), target_env = "sgx"), I can't really say with certainty that the conditions are correct everywhere.

@sanxiyn
Copy link
Member

sanxiyn commented Mar 19, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Mar 19, 2019

📌 Commit 32bcff1 has been approved by sanxiyn

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Mar 23, 2019
SGX target: fix std unit tests

This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass.

rust-lang#59009 must be merged first.
@bors
Copy link
Contributor

bors commented Mar 24, 2019

⌛ Testing commit 32bcff1 with merge 73daa8197fb59d29fe452cef646f82aa2d94d6b3...

@bors
Copy link
Contributor

bors commented Mar 24, 2019

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 24, 2019
@tesuji
Copy link
Contributor

tesuji commented Mar 24, 2019

Testing std stage1 (i686-pc-windows-msvc -> i686-pc-windows-msvc)
   Compiling std v0.0.0 (C:\projects\rust\src\libstd)
[RUSTC-TIMING] run_time_detect test:true 1.188
[RUSTC-TIMING] env test:true 1.890
error[E0433]: failed to resolve: use of undeclared type or module `os`
    --> src\libstd\net\tcp.rs:1575:36
     |
1575 |         fn render_inner(addr: &dyn os::windows::io::AsRawSocket) -> impl fmt::Debug {
     |                                    ^^ use of undeclared type or module `os`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 24, 2019
@jethrogb
Copy link
Contributor Author

Fixed

@sanxiyn
Copy link
Member

sanxiyn commented Mar 26, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Mar 26, 2019

📌 Commit f229422 has been approved by sanxiyn

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 26, 2019
@bors
Copy link
Contributor

bors commented Mar 26, 2019

⌛ Testing commit f229422 with merge 54479c6...

bors added a commit that referenced this pull request Mar 26, 2019
SGX target: fix std unit tests

This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass.

#59009 must be merged first.
@bors
Copy link
Contributor

bors commented Mar 26, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: sanxiyn
Pushing 54479c6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 26, 2019
@bors bors merged commit f229422 into rust-lang:master Mar 26, 2019
@workingjubilee workingjubilee added the O-SGX Target: SGX label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. O-SGX Target: SGX S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants