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

[CI] Run a thumbv7m-none-eabi binary using qemu-system-arm [IRR-2018-embedded] #53996

Merged
merged 14 commits into from
Nov 6, 2018

Conversation

sekineh
Copy link
Contributor

@sekineh sekineh commented Sep 6, 2018

What's included?

  • Run a thumbv7m-none-eabi binary using qemu-system-arm
  • We are using cortex-m-rt = "=0.5.4" which does not use proc_macro.
    (reason: stage2 build of rustc does not work well with proc_macro in run-make phase.)
  • We are using GNU LD for now.

Blocker

All resolved.

Update

#[panic_handler] will be stabilized in Rust 1.30.

CC @kennytm @jamesmunns @nerdyvaishali

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(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 Sep 6, 2018
@japaric
Copy link
Member

japaric commented Sep 18, 2018

r? @japaric

Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @sekineh!

This LGTM in terms of what's being tested but I'd like to see this test directly use a community maintained crate.


# hint: we could set variables per $(TARGET) basis in order to support other targets.
CRATE := lm3s6965evb
CRATE_URL := https://github.com/japaric/lm3s6965evb
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to use the cortex-m-rt crate here since it's maintained by the WG. You would have to:

  • modify that crate's memory.x file to match this one
  • copy lm3s6965evb's main.rs into the examples directory of the cortex-m-rt crate

and if you add a .cargo/config file with these lines (but uncommented) to cortex-m-rt then cargo run --example qemu --target $(TARGET) should build the example and then run it on QEMU in a single step.

Feel free to send a PR and I'll review it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do this first. (make a PR for cortex-m-rt)

Copy link
Contributor Author

@sekineh sekineh Sep 20, 2018

Choose a reason for hiding this comment

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

When moved to cortex-m-rt, semihosting did not worked for me.
Needed some option.

HERE := $(shell pwd)


# hint: we could set variables per $(TARGET) basis in order to support other targets.
Copy link
Member

Choose a reason for hiding this comment

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

qemu-system-arm only supports full system emulation of the LM3S6965 and LM3S811 microcontrollers. They are both Cortex-M3 microcontrollers so we can test the thumbv6m-none-eabi and thumbv7m-none-eabi targets with either QEMU target. The thumbv7em-none-eabi and thumbv7em-none-eabihf targets have incompatible ISAs and they can crash QEMU.

It would be great to also test the thumbv6m-none-eabi target here since it's an older ARM architecture. If you are up to it you can do that in a follow-up PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahem, older... ;) Cortex-M0 is still very relevant, is there any support for a CM0 MCU in qemu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@therealprof I've run 4 binaries on qemu-system-arm. As I remember, some worked in different board setting. My theory is if an ISA (thumbv6m-none-eabi) is roughly a subset of another (thumbv7m-none-eabi), and there's no harmful register changes, it has chance to run successfully. I'll try with existing qemu setting for thumbv6m (Cortex-M0) also.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sekineh thumbv6m-none-eabi is indeed a subset of thumbv7m-none-eabi and code might run just fine on higher ISA versions. However to be on the safe(r) side you really want to test on a Cortex-M0(+) target or emulation.

Copy link
Member

Choose a reason for hiding this comment

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

@therealprof these are the Cortex CPUs QEMU 3.0.0 supports:

  cortex-a15
  cortex-a7
  cortex-a8
  cortex-a9
  cortex-m3
  cortex-m33
  cortex-m4
  cortex-r5
  cortex-r5f

No cortex-m0 or cortex-m4f but you can run code compiled for thumbv6m-none-eabi using -cpu cortex-m3 since the M0 ISA is a subset of the M3 ISA. We can't run code compiled for the thumbv7em-none-eabihf though because the FPU instructions crash QEMU.

I'm not entirely sure if -machine is completely orthogonal to -cpu but I would prefer not to mix a Cortex-M3 machine with -cpu cortex-m4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I successfully ran the thumv6m-none-eabi binary on qemu -cpu cortex-m3

sekineh@sekineh-VirtualBox:~/cortex-m-rt_me$ cargo run --example qemu --target thumbv6m-none-eabi
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s                                                    
     Running `qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel target/thumbv6m-none-eabi/debug/examples/qemu`
x = 42

-cd $(WORK_DIR) && rm -rf $(CRATE)
cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
cd $(WORK_DIR)/$(CRATE) && $(CARGO) build --target $(TARGET) -v
cd $(WORK_DIR)/$(CRATE) && qemu-system-arm \
Copy link
Member

Choose a reason for hiding this comment

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

Could you also test the release binary here? That would check that optimizations don't produce an invalid binary (it has happened before).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current commit does both debug and --release.

@sekineh
Copy link
Contributor Author

sekineh commented Sep 18, 2018

Thanks for the review, @japaric !
I’ll look into required modifications.

@therealprof
Copy link
Contributor

@japaric Yeah, I'm well aware that this is possible. But it also means we won't be able to detect invalid opcodes generated by rustc which I thought was kind of the point of the exercise?

@japaric
Copy link
Member

japaric commented Sep 20, 2018

@therealprof the main goal of this test is to check that future changes won't break linking or generate an invalid binary (e.g. a symbol disappears from the final binary due to changes in how rustc decides symbol visibility).

Would you prefer that we don't test thumbv6m-none-eabi? I don't see any downside to also testing thumbv6m-none-eabi with -cpu cortex-m3. It might eventually catch some codegen bug in the ARMv6-M backend.

@therealprof
Copy link
Contributor

@japaric You don't need to run the binary to check for symbols. Of course it's fine to run the binaries but it would be a whole lot better if we could make sure that the generated code does not accidentally contain CM3 instructions or branches with targets outside of the supported range.

@sekineh sekineh changed the title [Do not merge] [CI] Run a thumbv7m-none-eabi binary using qemu-system-arm [IRR-2018-embedded] [WIP] [CI] Run a thumbv7m-none-eabi binary using qemu-system-arm [IRR-2018-embedded] Sep 24, 2018
@sekineh sekineh changed the title [WIP] [CI] Run a thumbv7m-none-eabi binary using qemu-system-arm [IRR-2018-embedded] [CI] Run a thumbv7m-none-eabi binary using qemu-system-arm [IRR-2018-embedded] Sep 30, 2018
@sekineh
Copy link
Contributor Author

sekineh commented Sep 30, 2018

@japaric I think I modified the patch as you've suggested.

A problem I see is it does not work on my local env due to the error I'm not familiar with:

stdout

mkdir -p /home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu
cd /home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu && rm -rf cortex-m-rt
cd /home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu && bash -x /home/sekineh/rustme12/src/test/run-make/thumb-none-qemu/../git_clone_sha1.sh cortex-m-rt https://github.com/rust-embedded/cortex-m-rt 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd
HEAD is now at 62972c8 Merge pull request #129 from rust-embedded/release
cd /home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu/cortex-m-rt && /home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/stage0/bin/cargo run --target thumbv7m-none-eabi --example qemu           | grep "x = 42"
Makefile:25: recipe for target 'all' failed

stderr

+ git clone https://github.com/rust-embedded/cortex-m-rt cortex-m-rt
Cloning into 'cortex-m-rt'...
+ cd cortex-m-rt
+ git reset --hard 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling proc-macro2 v0.4.19
   Compiling unicode-xid v0.1.0
   Compiling rand_core v0.2.1
   Compiling cortex-m-semihosting v0.3.1
   Compiling vcell v0.1.0
   Compiling cortex-m-rt v0.6.4 (file:///home/sekineh/rustme12/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu/cortex-m-rt)
   Compiling cortex-m v0.5.7
   Compiling bare-metal v0.2.3
   Compiling r0 v0.2.2
   Compiling aligned v0.2.0
   Compiling panic-halt v0.2.0
   Compiling volatile-register v0.2.0
   Compiling rand v0.5.5
error[E0463]: can't find crate for `proc_macro`
  --> /home/sekineh/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.19/src/lib.rs:53:1
   |
53 | extern crate proc_macro;
   | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `proc-macro2`.
warning: build failed, waiting for other jobs to finish...
error: build failed
make: *** [all] Error 1

------------------------------------------

thread '[run-make] run-make/thumb-none-qemu' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3267:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@sekineh
Copy link
Contributor Author

sekineh commented Oct 1, 2018

Make writes its output to stdout and bash -x writes its output to stderr. This makes log harder to read.

I feel like I want to move the logic into bash script where I can use pushd / popd.

-cd $(WORK_DIR) && rm -rf $(CRATE)
cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu | grep "x = 42"
cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu --release | grep "x = 42"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move logic l23-28 into separate file like script.sh? It will make error log clearer.

@japaric
Copy link
Member

japaric commented Oct 4, 2018

It looks like the proc_macro crate is not available for the host when testing a target that's not the host. I have seen something like this when using a stage1 build via rustup:

$ grep '^target' config.toml
target = ["thumbv7m-none-eabi"]

$ ./x.py build --stage 1 src/libstd

$ rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1

$ cd /path/to/some/project

$ # this fails if proc_macro appears somewhere in the dependency graph
$ cargo +stage1 build --target thumbv7m-none-eabi

@alexcrichton @kennytm would it be possible to tweak bootstrap to compile and install / copy a host libproc_macro.{rlib,so} into the build sysroot when running run-make tests for some target that's not the host? Or is there a reason why proc_macro is not available in the build sysroot?

@japaric
Copy link
Member

japaric commented Oct 4, 2018

Actually, it looks like libproc_macro is in e.g. stage1 sysroot:

$ cd $(rustc +stage1 --print sysroot)

$ find -name 'libproc_macro*'
./lib/libproc_macro-09d5bb2a63717cb1.so
./lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-956e91f4391bd306.so

But the hashes of the .so libraries don't match, which is not the case for, say, a nightly toolchain:

$ cd $(rustc +nightly --print sysroot)

$ find -name 'libproc_macro*'
./lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-96fdba3b331ee226.so
./lib/libproc_macro-96fdba3b331ee226.so

@kennytm
Copy link
Member

kennytm commented Oct 4, 2018

@japaric IIRC if you need anything proc-macro-related you'll need stage2. The fix for this should be #49219 which returned to limbo again 🤷

@japaric
Copy link
Member

japaric commented Oct 4, 2018

@kennytm hmm, I'm seeing the same error as @sekineh with ./x.py test --target thumbv7m-none-eabi src/test/run-make, which uses stage 2. Could it be the issue that run-make is different from run-make-fulldeps and that this should go in the latter?

@kennytm
Copy link
Member

kennytm commented Oct 4, 2018

@japaric Yes fulldeps is intended for the stage2 stuff. But fulldeps assumes TARGET == HOST.

@alexcrichton
Copy link
Member

Yeah @kennytm is correct here, there's no great way to use proc-macro2 from target-only tests without changing a fair amount in our build setup unfortunately :(

@japaric
Copy link
Member

japaric commented Oct 9, 2018

OK, in that case we'll have to test against a version of cortex-m-rt that doesn't use proc macros.

@sekineh, sorry for the back and forth but could you change the run-make test to include a binary Cargo project who's src/main.rs is basically this file but that uses version v0.5.4 of cortex-m-rt?

The version must be exactly that one ("=0.5.4" in Cargo.toml); newer versions depend on cortex-m-rt v0.6.x to allow inter-operation so they'll fail to build.

The syntax of the entry point will be slightly different and you'll have to copy over both .cargo/config and memory.x to this new Cargo project. You should be able to test (cargo run) this Cargo project in standalone mode before you put it in the run-make directory.

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 25, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-distcheck 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.
[00:04:59] Caused by:
[00:04:59]   failed to download package from registry
[00:04:59] 
[00:04:59] Caused by:
[00:04:59]   failed to get 200 response from `https://crates.io/api/v1/crates/openssl-src/111.0.1+1.1.1/download`, got 403
[00:04:59] 
[00:04:59] 
[00:04:59] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "vendor"
[00:04:59] 
[00:04:59] 
[00:04:59] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test distcheck
[00:04:59] Build completed unsuccessfully in 0:02:03
---
travis_time:end:37693080:start=1540496540762579303,finish=1540496540771127058,duration=8547755
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:14f80cdd
$ 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:038beccc
travis_time:start:038beccc
$ 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:1f8f9a50
$ 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)

@pietroalbini
Copy link
Member

@bors retry (crates.io failure)

@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 Oct 25, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Oct 26, 2018
[CI] Run a `thumbv7m-none-eabi` binary using `qemu-system-arm` [IRR-2018-embedded]

## What's included?

- Run a `thumbv7m-none-eabi` binary using `qemu-system-arm`
- We are using `cortex-m-rt = "=0.5.4"` which does not use `proc_macro`.
(reason: stage2 build of rustc does not work well with `proc_macro` in `run-make` phase.)
- We are using GNU LD for now.

## Blocker

All resolved.
- ~[Waiting] `#[panic_handler]` is not available in stable.~
  - [Merged] rust-lang#53619
- ~[Waiting] https://github.com/japaric/lm3s6965evb: does not compile on stable.~
  - [OK] dependent crate ~`panic-abort`~ `panic-halt`: already moved to use `#[panic_handler]`.

## Update

`#[panic_handler]` will be stabilized in Rust 1.30.

CC @kennytm @jamesmunns @nerdyvaishali
@bors
Copy link
Contributor

bors commented Oct 26, 2018

⌛ Testing commit 35bbcf1 with merge a6242b7711bab7a987b83e869bd3abc70d99ba22...

@bors
Copy link
Contributor

bors commented Oct 26, 2018

💔 Test failed - status-travis

@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 Oct 26, 2018
@rust-highfive
Copy link
Collaborator

The job dist-various-1 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.
[00:53:33] test [run-make] run-make/wasm-export-all-symbols ... ok
[00:53:33] test [run-make] run-make/wasm-panic-small ... ok
[00:53:33] test [run-make] run-make/wasm-symbols-not-exported ... ok
[00:53:33] test [run-make] run-make/wasm-symbols-not-imported ... ok
[00:53:37] test [run-make] run-make/thumb-none-qemu ... FAILED
[00:53:39] 
[00:53:39] failures:
[00:53:39] 
[00:53:39] 
[00:53:39] ---- [run-make] run-make/thumb-none-qemu stdout ----
[00:53:39] error: make failed
[00:53:39] status: exit code: 2
[00:53:39] command: "make"
[00:53:39] stdout:
[00:53:39] stdout:
[00:53:39] ------------------------------------------
[00:53:39] bash script.sh
[00:53:39] AWS_ACCESS_KEY_ID=AKIAJAMV3QAMMA6AXHFQ
[00:53:39] AWS_SECRET_ACCESS_KEY=[secure]
[00:53:39] BOOTSTRAP_PARENT_ID=1052
[00:53:39] BOOTSTRAP_PYTHON=/usr/bin/python2.7
[00:53:39] BUILD_DIR=/checkout/obj/build
[00:53:39] CARGO=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo
[00:53:39] CARGO_HOME=/cargo
[00:53:39] CC_armebv7r_none_eabi=arm-none-eabi-gcc
[00:53:39] CC_armebv7r_none_eabi=arm-none-eabi-gcc
[00:53:39] CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc
[00:53:39] CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc
[00:53:39] CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc
[00:53:39] CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc
[00:53:39] CI_JOB_NAME=dist-various-1
[00:53:39] DEPLOY=1
[00:53:39] HERE=/checkout/src/test/run-make/thumb-none-qemu
[00:53:39] HOME=/home/user
[00:53:39] HOSTNAME=4782378fbc1c
[00:53:39] HOST_RPATH_DIR=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib
[00:53:39] LD_LIBRARY_PATH=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib
[00:53:39] LD_LIB_PATH_ENVVAR=LD_LIBRARY_PATH
[00:53:39] LLVM_COMPONENTS=
[00:53:39] LLVM_CXXFLAGS=
[00:53:39] MAKEFLAGS=
[00:53:39] MAKELEVEL=1
[00:53:39] MFLAGS=
[00:53:39] PATH=/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[00:53:39] PWD=/checkout/src/test/run-make/thumb-none-qemu
[00:53:39] PYTHON=/usr/bin/python2.7
[00:53:39] RUN_MAKE_TARGETS=thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf
[00:53:39] RUSTC=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc
[00:53:39] RUST_CONFIGURE_ARGS=--musl-root-armv5te=/musl-armv5te       --musl-root-arm=/musl-arm       --musl-root-armhf=/musl-armhf       --musl-root-armv7=/musl-armv7       --musl-root-aarch64=/musl-aarch64       --musl-root-mips=/musl-mips       --musl-root-mipsel=/musl-mipsel       --enable-emscripten       --disable-docs --set build.print-step-timings --enable-verbose-tests --enable-sccache --disable-manage-submodules --enable-locked-deps --enable-cargo-native-static --disable-dist-src --release-channel=nightly --enable-llvm-static-stdcpp --set rust.remap-debuginfo --enable-missing-tools
[00:53:39] RUST_RELEASE_CHANNEL=nightly
[00:53:39] S=/checkout
[00:53:39] SCCACHE_BUCKET=rust-lang-ci-sccache2
[00:53:39] SCCACHE_REGION=us-west-1
[00:53:39] SCRIPT=python2.7 ../x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf src/test/run-make &&       python2.7 ../x.py dist --target asmjs-unknown-emscripten,wasm32-unknown-emscripten,x86_64-rumprun-netbsd,mips-unknown-linux-musl,mipsel-unknown-linux-musl,arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf,armv5te-unknown-linux-gnueabi,armv5te-unknown-linux-musleabi,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl,sparc64-unknown-linux-gnu,x86_64-unknown-redox,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,armebv7r-none-eabi,armebv7r-none-eabihf,armv7r-none-eabi,armv7r-none-eabihf
[00:53:39] SHLVL=3
[00:53:39] SRC=/checkout
[00:53:39] STAGING_DIR=/tmp
[00:53:39] TARGET=thumbv6m-none-eabi
[00:53:39] TARGETS=asmjs-unknown-emscripten,wasm32-unknown-emscripten,x86_64-rumprun-netbsd,mips-unknown-linux-musl,mipsel-unknown-linux-musl,arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf,armv5te-unknown-linux-gnueabi,armv5te-unknown-linux-musleabi,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl,sparc64-unknown-linux-gnu,x86_64-unknown-redox,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,armebv7r-none-eabi,armebv7r-none-eabihf,armv7r-none-eabi,armv7r-none-eabihf
[00:53:39] TARGET_RPATH_DIR=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/thumbv6m-none-eabi/lib
[00:53:39] TERM=xterm
[00:53:39] TMPDIR=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu
[00:53:39] TRAVIS=true
[00:53:39] TRAVIS_BRANCH=auto
[00:53:39] TRAVIS_BRANCH=auto
[00:53:39] WORK_DIR=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu
[00:53:39] _=/usr/bin/env
[00:53:39] __COMPAT_LAYER=RunAsInvoker
[00:53:39] /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu /checkout/src/test/run-make/thumb-none-qemu
[00:53:39] /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu/example /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu /checkout/src/test/run-make/thumb-none-qemu
[00:53:39] Makefile:27: recipe for target 'all' failed
[00:53:39] ------------------------------------------
[00:53:39] stderr:
[00:53:39] ------------------------------------------
[00:53:39] ------------------------------------------
[00:53:39] + CRATE=example
[00:53:39] + env
[00:53:39] + sort
[00:53:39] + mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu
[00:53:39] + pushd /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu
[00:53:39] + rm -rf example
[00:53:39] + cp -a /checkout/src/test/run-make/thumb-none-qemu/example .
[00:53:39] + pushd example
[00:53:39] + env 'RUSTFLAGS=-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x' /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo run --target thumbv6m-none-eabi
[00:53:39] + grep 'x = 42'
[00:53:39]     Blocking waiting for file lock on the registry index
[00:53:39]  Downloading panic-halt v0.2.0
[00:53:39]  Downloading panic-halt v0.2.0
[00:53:39]  Downloading cortex-m-semihosting v0.3.1
[00:53:39]  Downloading cortex-m-rt v0.5.4
[00:53:39]  Downloading cortex-m v0.5.7
[00:53:39]  Downloading r0 v0.2.2
[00:53:39]  Downloading volatile-register v0.2.0
[00:53:39]     Blocking waiting for file lock on bare-metal-0.2.3.crate
[00:53:39]     Blocking waiting for file lock on vcell-0.1.0.crate
[00:53:39]    Compiling cortex-m v0.5.7
[00:53:39]    Compiling vcell v0.1.0
[00:53:39]    Compiling cortex-m-semihosting v0.3.1
[00:53:39]    Compiling cortex-m-rt v0.5.4
[00:53:39]    Compiling aligned v0.2.0
[00:53:39]    Compiling bare-metal v0.2.3
[00:53:39]    Compiling r0 v0.2.2
[00:53:39]    Compiling panic-halt v0.2.0
[00:53:39]    Compiling volatile-register v0.2.0
[00:53:39]    Compiling example v0.1.0 (/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-qemu/thumb-none-qemu/example)
[00:53:39]     Finished dev [unoptimized + debuginfo] target(s) in 4.66s
[00:53:39]      Running `target/thumbv6m-none-eabi/debug/example`
[00:53:39] target/thumbv6m-none-eabi/debug/example: 1: target/thumbv6m-none-eabi/debug/example: Syntax error: word unexpected (expecting ")")
[00:53:39] make: *** [all] Error 1
[00:53:39] ------------------------------------------
[00:53:39] 
[00:53:39] 
[00:53:39] thread '[run-make] run-make/thumb-none-qemu' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:53:39] 
[00:53:39] 
[00:53:39] failures:
[00:53:39]     [run-make] run-make/thumb-none-qemu
[00:53:39]     [run-make] run-make/thumb-none-qemu
[00:53:39] 
[00:53:39] test result: FAILED. 8 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[00:53:39] 
[00:53:39] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:53:39] 
[00:53:39] 
[00:53:39] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/thumbv6m-none-eabi/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-make" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make" "--stage-id" "stage2-thumbv6m-none-eabi" "--mode" "run-make" "--target" "thumbv6m-none-eabi" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "arm-none-eabi-gcc" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/thumbv6m-none-eabi/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--llvm-version" "8.0.0svn\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:53:39] 
[00:53:39] 
[00:53:39] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf src/test/run-make
[00:53:39] Build completed unsuccessfully in 0:47:19
---
travis_time:end:0c51746a:start=1540550164670387193,finish=1540550164676845634,duration=6458441
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:00e521b6
$ 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:29b9764c
travis_time:start:29b9764c
$ 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:2290ed5f
$ 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)

@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 Oct 26, 2018
@sekineh
Copy link
Contributor Author

sekineh commented Oct 27, 2018

Retrying locally after ./x.py clean....

@sekineh
Copy link
Contributor Author

sekineh commented Oct 27, 2018

$ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf src/test/run-make

perfectly succeeds in my environment.

I'm using

$ qemu-system-arm --version
QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.31), Copyright (c) 2003-2008 Fabrice Bellard

@japaric
Copy link
Member

japaric commented Oct 27, 2018

[00:53:39] Running target/thumbv6m-none-eabi/debug/example

[00:53:39] target/thumbv6m-none-eabi/debug/example: 1: target/thumbv6m-none-eabi/debug/example: Syntax error: word unexpected (expecting ")")

A Cargo runner needs to be set in the test. Right now it's trying to directly run the cross compiled binary on the host.

A runner can be set by (a) setting target.$something.runner to qemu-system-arm or (b) by setting TARGET_$NAME_RUNNER=qemu-system-arm in the environment before running Cargo. The quickstart template and the cortex-m-rt crate both use option (a).

@sekineh perhaps you have the .cargo/config file locally but have not checked it in because of some .gitignore file in this repository?

@japaric
Copy link
Member

japaric commented Nov 6, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Nov 6, 2018

📌 Commit f872303 has been approved by japaric

@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 Nov 6, 2018
@bors
Copy link
Contributor

bors commented Nov 6, 2018

⌛ Testing commit f872303 with merge 15d7704...

bors added a commit that referenced this pull request Nov 6, 2018
[CI] Run a `thumbv7m-none-eabi` binary using `qemu-system-arm` [IRR-2018-embedded]

## What's included?

- Run a `thumbv7m-none-eabi` binary using `qemu-system-arm`
- We are using `cortex-m-rt = "=0.5.4"` which does not use `proc_macro`.
(reason: stage2 build of rustc does not work well with `proc_macro` in `run-make` phase.)
- We are using GNU LD for now.

## Blocker

All resolved.
- ~[Waiting] `#[panic_handler]` is not available in stable.~
  - [Merged] #53619
- ~[Waiting] https://github.com/japaric/lm3s6965evb: does not compile on stable.~
  - [OK] dependent crate ~`panic-abort`~ `panic-halt`: already moved to use `#[panic_handler]`.

## Update

`#[panic_handler]` will be stabilized in Rust 1.30.

CC @kennytm @jamesmunns @nerdyvaishali
@bors
Copy link
Contributor

bors commented Nov 6, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: japaric
Pushing 15d7704 to master...

@bors bors merged commit f872303 into rust-lang:master Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

9 participants