Skip to content

Commit 8b18964

Browse files
author
Travis Wagner
committed
imported library/backtrace into main repository
1 parent 5018747 commit 8b18964

File tree

97 files changed

+9241
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+9241
-4
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@
22
path = src/llvm-project
33
url = https://github.com/rust-lang/llvm-project.git
44
branch = rustc/16.0-2023-06-05
5-
[submodule "library/backtrace"]
6-
path = library/backtrace
7-
url = https://github.com/rust-lang/backtrace-rs.git

library/backtrace

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# This workflow checks if a PR commit has changed the size of a hello world Rust program.
2+
# It downloads Rustc and compiles two versions of a stage0 compiler - one using the base commit
3+
# of the PR, and one using the latest commit in the PR.
4+
# If the size of the hello world program has changed, it posts a comment to the PR.
5+
name: Check binary size
6+
7+
on:
8+
pull_request_target:
9+
branches:
10+
- master
11+
12+
jobs:
13+
test:
14+
name: Check binary size
15+
runs-on: ubuntu-latest
16+
permissions:
17+
pull-requests: write
18+
steps:
19+
- name: Print info
20+
run: |
21+
echo "Current SHA: ${{ github.event.pull_request.head.sha }}"
22+
echo "Base SHA: ${{ github.event.pull_request.base.sha }}"
23+
- name: Clone Rustc
24+
uses: actions/checkout@v3
25+
with:
26+
repository: rust-lang/rust
27+
fetch-depth: 1
28+
- name: Fetch backtrace
29+
run: git submodule update --init library/backtrace
30+
- name: Create hello world program that uses backtrace
31+
run: printf "fn main() { panic!(); }" > foo.rs
32+
- name: Build binary with base version of backtrace
33+
run: |
34+
printf "[llvm]\ndownload-ci-llvm = true\n\n[rust]\nincremental = false\n" > config.toml
35+
cd library/backtrace
36+
git remote add head-pr https://github.com/${{ github.event.pull_request.head.repo.full_name }}
37+
git fetch --all
38+
git checkout ${{ github.event.pull_request.base.sha }}
39+
cd ../..
40+
git add library/backtrace
41+
python3 x.py build library --stage 0
42+
./build/x86_64-unknown-linux-gnu/stage0-sysroot/bin/rustc -O foo.rs -o binary-reference
43+
- name: Build binary with PR version of backtrace
44+
run: |
45+
cd library/backtrace
46+
git checkout ${{ github.event.pull_request.head.sha }}
47+
cd ../..
48+
git add library/backtrace
49+
rm -rf build/x86_64-unknown-linux-gnu/stage0-std
50+
python3 x.py build library --stage 0
51+
./build/x86_64-unknown-linux-gnu/stage0-sysroot/bin/rustc -O foo.rs -o binary-updated
52+
- name: Display binary size
53+
run: |
54+
ls -la binary-*
55+
echo "SIZE_REFERENCE=$(stat -c '%s' binary-reference)" >> "$GITHUB_ENV"
56+
echo "SIZE_UPDATED=$(stat -c '%s' binary-updated)" >> "$GITHUB_ENV"
57+
- name: Post a PR comment if the size has changed
58+
uses: actions/github-script@v6
59+
with:
60+
script: |
61+
const reference = process.env.SIZE_REFERENCE;
62+
const updated = process.env.SIZE_UPDATED;
63+
const diff = updated - reference;
64+
const plus = diff > 0 ? "+" : "";
65+
const diff_str = `${plus}${diff}B`;
66+
67+
if (diff !== 0) {
68+
const percent = (((updated / reference) - 1) * 100).toFixed(2);
69+
// The body is created here and wrapped so "weirdly" to avoid whitespace at the start of the lines,
70+
// which is interpreted as a code block by Markdown.
71+
const body = `Below is the size of a hello-world Rust program linked with libstd with backtrace.
72+
73+
Original binary size: **${reference}B**
74+
Updated binary size: **${updated}B**
75+
Difference: **${diff_str}** (${percent}%)`;
76+
77+
github.rest.issues.createComment({
78+
issue_number: context.issue.number,
79+
owner: context.repo.owner,
80+
repo: context.repo.repo,
81+
body
82+
})
83+
}
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-20.04
20+
rust: stable
21+
- os: ubuntu-20.04
22+
rust: beta
23+
- os: ubuntu-20.04
24+
rust: nightly
25+
- os: macos-latest
26+
rust: stable
27+
- os: macos-latest
28+
rust: nightly
29+
# Note that these are on nightly due to rust-lang/rust#63700 not being
30+
# on stable yet
31+
- os: windows-latest
32+
rust: stable-x86_64-msvc
33+
- os: windows-latest
34+
rust: stable-i686-msvc
35+
- os: windows-latest
36+
rust: stable-x86_64-gnu
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
submodules: true
41+
- name: Install Rust (rustup)
42+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
43+
shell: bash
44+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
45+
shell: bash
46+
47+
# full fidelity of backtraces on 32-bit msvc requires frame pointers, so
48+
# enable that for our tests
49+
- name: Force frame pointers
50+
run: echo RUSTFLAGS="-Cforce-frame-pointers $RUSTFLAGS" >> $GITHUB_ENV
51+
shell: bash
52+
if: matrix.rust == 'stable-i686-msvc'
53+
54+
- run: cargo build
55+
- run: cargo test
56+
- run: cargo test --features "serialize-rustc"
57+
- run: cargo test --features "serialize-serde"
58+
- run: cargo test --features "verify-winapi"
59+
- run: cargo test --features "cpp_demangle"
60+
- run: cargo test --no-default-features
61+
- run: cargo test --no-default-features --features "std"
62+
- run: cargo test --manifest-path crates/cpp_smoke_test/Cargo.toml
63+
# This test is specifically about packed debuginfo with `*.dSYM` files
64+
- run: cargo test --manifest-path crates/macos_frames_test/Cargo.toml
65+
env:
66+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: packed
67+
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: packed
68+
- run: cargo test --features gimli-symbolize --manifest-path crates/without_debuginfo/Cargo.toml
69+
- run: cargo test --manifest-path crates/line-tables-only/Cargo.toml --features gimli-symbolize
70+
71+
# Test debuginfo compression still works
72+
- run: cargo test
73+
if: contains(matrix.os, 'ubuntu')
74+
env:
75+
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib-gabi"
76+
- run: cargo test
77+
if: contains(matrix.os, 'ubuntu')
78+
env:
79+
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib-gnu"
80+
81+
# Test that, on macOS, packed/unpacked debuginfo both work
82+
- run: cargo clean && cargo test
83+
# Test that, on macOS, packed/unpacked debuginfo both work
84+
if: matrix.os == 'macos-latest'
85+
env:
86+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: unpacked
87+
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: unpacked
88+
- run: cargo clean && cargo test
89+
if: matrix.os == 'macos-latest'
90+
env:
91+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: packed
92+
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: packed
93+
# Test that, on macOS, binaries with no UUID work
94+
- run: cargo clean && cargo test
95+
if: matrix.os == 'macos-latest'
96+
env:
97+
RUSTFLAGS: "-C link-arg=-Wl,-no_uuid"
98+
99+
# Test that, on Linux, packed/unpacked debuginfo both work
100+
- run: cargo clean && cargo test
101+
if: matrix.rust == 'nightly'
102+
env:
103+
RUSTFLAGS: "-C split-debuginfo=unpacked -Zunstable-options"
104+
- run: cargo clean && cargo test
105+
if: matrix.rust == 'nightly'
106+
env:
107+
RUSTFLAGS: "-C split-debuginfo=packed -Zunstable-options"
108+
109+
# Test that separate debug info works
110+
- run: ./ci/debuglink-docker.sh
111+
if: contains(matrix.os, 'ubuntu')
112+
113+
# Test that including as a submodule will still work, both with and without
114+
# the `backtrace` feature enabled.
115+
- run: cargo build --manifest-path crates/as-if-std/Cargo.toml
116+
- run: cargo build --manifest-path crates/as-if-std/Cargo.toml --no-default-features
117+
118+
windows_arm64:
119+
name: Windows AArch64
120+
runs-on: windows-latest
121+
steps:
122+
- uses: actions/checkout@v3
123+
with:
124+
submodules: true
125+
- name: Install Rust
126+
run: rustup update stable --no-self-update && rustup default stable
127+
shell: bash
128+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
129+
shell: bash
130+
- run: rustup target add aarch64-pc-windows-msvc
131+
- run: cargo test --no-run --target aarch64-pc-windows-msvc
132+
- run: cargo test --no-run --target aarch64-pc-windows-msvc --features verify-winapi
133+
134+
ios:
135+
name: iOS
136+
runs-on: macos-latest
137+
strategy:
138+
matrix:
139+
include:
140+
- target: aarch64-apple-ios
141+
sdk: iphoneos
142+
- target: x86_64-apple-ios
143+
sdk: iphonesimulator
144+
steps:
145+
- uses: actions/checkout@v3
146+
with:
147+
submodules: true
148+
- run: rustup target add ${{ matrix.target }}
149+
- run: |
150+
export RUSTFLAGS=-Dwarnings
151+
export SDK_PATH=`xcrun --show-sdk-path --sdk ${{ matrix.sdk }}`
152+
export RUSTFLAGS="-C link-arg=-isysroot -C link-arg=$SDK_PATH"
153+
cargo test --no-run --target ${{ matrix.target }}
154+
name: Build tests
155+
156+
docker:
157+
name: Docker
158+
runs-on: ubuntu-20.04
159+
strategy:
160+
fail-fast: false
161+
matrix:
162+
target:
163+
- aarch64-unknown-linux-gnu
164+
- arm-unknown-linux-gnueabihf
165+
- armv7-unknown-linux-gnueabihf
166+
- i586-unknown-linux-gnu
167+
- i686-unknown-linux-gnu
168+
- powerpc64-unknown-linux-gnu
169+
- s390x-unknown-linux-gnu
170+
- x86_64-pc-windows-gnu
171+
- x86_64-unknown-linux-gnu
172+
- x86_64-unknown-linux-musl
173+
- arm-linux-androideabi
174+
- armv7-linux-androideabi
175+
- aarch64-linux-android
176+
- i686-linux-android
177+
- x86_64-linux-android
178+
steps:
179+
- uses: actions/checkout@v3
180+
with:
181+
submodules: true
182+
- name: Install Rust
183+
run: rustup update stable && rustup default stable
184+
- run: rustup target add ${{ matrix.target }}
185+
- run: cargo generate-lockfile
186+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
187+
shell: bash
188+
- run: ./ci/run-docker.sh ${{ matrix.target }}
189+
190+
rustfmt:
191+
name: Rustfmt
192+
runs-on: ubuntu-20.04
193+
steps:
194+
- uses: actions/checkout@v3
195+
with:
196+
submodules: true
197+
- name: Install Rust
198+
run: rustup update stable && rustup default stable && rustup component add rustfmt
199+
- run: cargo fmt --all -- --check
200+
201+
build:
202+
name: Build Targets
203+
runs-on: ubuntu-20.04
204+
strategy:
205+
matrix:
206+
target:
207+
- wasm32-unknown-unknown
208+
- wasm32-wasi
209+
- x86_64-unknown-fuchsia
210+
- x86_64-fortanix-unknown-sgx
211+
- x86_64-unknown-illumos
212+
steps:
213+
- uses: actions/checkout@v3
214+
with:
215+
submodules: true
216+
- name: Install Rust
217+
run: rustup update nightly && rustup default nightly
218+
- run: rustup target add ${{ matrix.target }}
219+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
220+
shell: bash
221+
- run: cargo build --target ${{ matrix.target }}
222+
- run: cargo build --manifest-path crates/as-if-std/Cargo.toml --target ${{ matrix.target }}
223+
224+
msrv:
225+
name: MSRV
226+
runs-on: ubuntu-20.04
227+
steps:
228+
- uses: actions/checkout@v3
229+
with:
230+
submodules: true
231+
- name: Install Rust
232+
run: rustup update 1.55.0 && rustup default 1.55.0
233+
- run: cargo build
234+
235+
miri:
236+
name: Miri
237+
runs-on: ubuntu-20.04
238+
steps:
239+
- uses: actions/checkout@v3
240+
with:
241+
submodules: true
242+
- name: Install Miri
243+
run: |
244+
rustup toolchain install nightly --component miri
245+
rustup override set nightly
246+
cargo miri setup
247+
- run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test

library/backtrace/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target
2+
Cargo.lock

0 commit comments

Comments
 (0)