-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add crate build test for thumb*
targets. [IRR-2018-embedded]
#53190
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d71cc75
[CI] run-make: experimental thumb test
sekineh 320b240
[CI] run-make/thumb: add -vv to `cargo build` for diag
sekineh 9e2dc55
[CI] run-make/thumb: add log for `cargo build`
sekineh 5af644c
[CI] run-make/thumb: Add LD_LIBRARY_PATH experiment, etc.
sekineh 633832f
[CI] run-make/thumb: 1st working version with hacky workaround.
sekineh 7c438d4
[CI] run-make/thumb: remove hacky workaround.
sekineh bbbe441
[CI] run-make/thumb: tidy up variables
sekineh 6c52653
[CI] run-make/thumb: support 4 thumb*-none-eabi* targets:
sekineh 09854b0
[CI] run-make/thumb: remove a trailing space.
sekineh c2b612a
[CI] run-make/thumb: remove `-j 1` from cargo run
sekineh 5c654f2
use a simple script instead of `cargo clone`.
sekineh 62b3935
use TMPDIR instead of custom directory.
sekineh 10395f3
change variable definition order (basic thing first).
sekineh e9c2de8
shorten the url to fix tidy error.
sekineh ad78c2f
add copyright from template
sekineh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash -x | ||
|
||
# Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
# file at the top-level directory of this distribution and at | ||
# http://rust-lang.org/COPYRIGHT. | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
# Usage: $0 project_name url sha1 | ||
# Get the crate with the specified sha1. | ||
# | ||
# all arguments are required. | ||
# | ||
# See below link for git usage: | ||
# https://stackoverflow.com/questions/3489173#14091182 | ||
|
||
# Mandatory arguments: | ||
PROJECT_NAME=$1 | ||
URL=$2 | ||
SHA1=$3 | ||
|
||
function err_exit() { | ||
echo "ERROR:" $* | ||
exit 1 | ||
} | ||
|
||
git clone $URL $PROJECT_NAME || err_exit | ||
cd $PROJECT_NAME || err_exit | ||
git reset --hard $SHA1 || err_exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# How to run this | ||
# $ ./x.py clean | ||
# $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi src/test/run-make | ||
|
||
# Supported targets: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we now build required artifacts in |
||
# - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1) | ||
# - thumbv7em-none-eabi (Bare Cortex-M4, M7) | ||
# - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat) | ||
# - thumbv7m-none-eabi (Bare Cortex-M3) | ||
|
||
# See https://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or | ||
ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi)) | ||
|
||
# For cargo setting | ||
RUSTC := $(RUSTC_ORIGINAL) | ||
LD_LIBRARY_PATH := $(HOST_RPATH_DIR) | ||
# We need to be outside of 'src' dir in order to run cargo | ||
WORK_DIR := $(TMPDIR) | ||
|
||
HERE := $(shell pwd) | ||
|
||
CRATE := cortex-m | ||
CRATE_URL := https://github.com/rust-embedded/cortex-m | ||
CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0 | ||
|
||
all: | ||
env | ||
mkdir -p $(WORK_DIR) | ||
-cd $(WORK_DIR) && rm -rf $(CRATE) | ||
cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) | ||
cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v | ||
else | ||
|
||
all: | ||
|
||
endif |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this block be combined with the block above (line 980)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, I've written it in the form the second
if
is merged with the firstif
.Later, I divided them into two
if
s with clear intention. They are representing the two different purposes/concerns.Let me explain the intention(s) below.
The first
if
The first
if
serves for buildingcompile::Test
. Unfortunately, you can't buildcompile::Test
forno_std
. In that case, buildcompile::Std
instead. It should be in the form ofA
orB
. Adding unrelatedC
in one arm is not a good idea.It's also a verbatim copy of @japaric's code found in
dist.rs
and supposed to be like a idiom which would be used in various places consistently. In the currentbootstrap
code,test
support forno_std
target is quite minimum. To widen the supported coverage forno_std
, we might want to grepbuilder.ensure(compile::Test
and replace it with this snippet.But in future,
no_std
might getlibtest
support. At that time the wholeif
must be reverted back to the original single line:If you merged two
if
s, the whole change would be much less trivial.The second
if
The second
if
serves for a totally different purpose. For the majority ofrun-make
tests, host compiler is NEVER needed. It is needed because we must runcargo
and some dependent crate (e.g.cc
) requires host compiler to be successfully built.