Skip to content

Commit d8e66cd

Browse files
committed
WIP
1 parent ef94563 commit d8e66cd

File tree

6 files changed

+53
-64
lines changed

6 files changed

+53
-64
lines changed

.github/workflows/check.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
rust-version: [ 1.78.0, stable, beta, nightly ]
16+
rust-version: [ 1.80.0, stable, beta, nightly ]
1717
steps:
1818
- name: Checkout sources
1919
uses: actions/checkout@v2
2020

21-
- name: Install stable toolchain
22-
uses: actions-rust-lang/setup-rust-toolchain@v1
23-
with:
24-
toolchain: ${{ matrix.rust-version }}
25-
components: clippy, rustfmt, llvm-tools-preview
21+
- name: Install toolchain
22+
run: |
23+
rustup toolchain install ${{ matrix.rust-version }}
24+
rustup default ${{ matrix.rust-version }}
25+
rustup component add clippy rustfmt llvm-tools-preview
2626
2727
- name: Build
2828
run: cargo build --all --all-targets
@@ -31,22 +31,23 @@ jobs:
3131
run: cargo test
3232

3333
- name: Lint
34-
run: clippy --all -- -D warnings
34+
run: cargo clippy --all -- -D warnings
3535

3636
- name: Check Rust formatting
3737
run: cargo fmt --all -- --check
38+
3839
test-windows:
3940
name: Test on Windows
4041
runs-on: windows-latest
4142
steps:
4243
- name: Checkout sources
4344
uses: actions/checkout@v2
4445

45-
- name: Install stable toolchain
46-
uses: actions-rust-lang/setup-rust-toolchain@v1
47-
with:
48-
toolchain: 1.78.0
49-
components: clippy, rustfmt, llvm-tools-preview
46+
- name: Install toolchain
47+
run: |
48+
rustup toolchain install 1.80.0
49+
rustup default 1.80.0
50+
rustup component add clippy rustfmt llvm-tools-preview
5051
5152
- name: Build
5253
run: cargo build --all --all-targets

Cargo.lock

+24-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "cargo-pgo"
33
version = "0.2.8"
44
edition = "2021"
5-
rust-version = "1.78.0"
5+
rust-version = "1.80.0"
66

77
description = "Cargo subcommand for optimizing Rust binaries with PGO and BOLT."
88
repository = "https://github.com/kobzol/cargo-pgo"
@@ -30,9 +30,9 @@ which = "7"
3030
clap = { version = "4.5", features = ["derive"] }
3131
log = "0.4"
3232
env_logger = "0.11"
33-
colored = "2"
33+
colored = "3"
3434
cargo_metadata = "0.19"
35-
humansize = "1"
35+
humansize = "2"
3636
semver = "1"
3737
tempfile = "3.14"
3838
regex = "1.11"
@@ -42,6 +42,3 @@ walkdir = "2.5"
4242
shellwords = "1.1"
4343
blake3 = "1.4"
4444
version_check = "0.9"
45-
46-
[dev-dependencies]
47-
version_check = "0.9"

src/pgo/optimize.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use anyhow::anyhow;
55
use cargo_metadata::diagnostic::DiagnosticLevel;
66
use cargo_metadata::{CompilerMessage, Message};
77
use colored::Colorize;
8-
use humansize::file_size_opts::BINARY;
9-
use humansize::FileSize;
8+
use humansize::{format_size, BINARY};
109
use once_cell::sync::OnceCell;
1110
use regex::Regex;
1211
use rustc_demangle::{demangle, Demangle};
@@ -153,7 +152,7 @@ fn print_pgo_profile_stats(stats: &ProfileStats, pgo_dir: &Path) -> anyhow::Resu
153152
} else {
154153
"file"
155154
},
156-
stats.total_size.file_size(BINARY).unwrap().yellow(),
155+
format_size(stats.total_size, BINARY).yellow(),
157156
cli_format_path(pgo_dir.display())
158157
);
159158
Ok(())

tests/integration/pgo.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,8 @@ rustflags = ["-Ctarget-cpu=native"]
326326
);
327327

328328
let output = project.cmd(&["build", "--", "-v"]).run()?;
329-
println!("{}", output.stderr());
330-
assert!(output.stderr().contains("-Ctarget-cpu=native"));
331-
assert!(output.stderr().contains("-Cprofile-generate"));
329+
output.assert_stderr_contains("-Ctarget-cpu=native");
330+
output.assert_stderr_contains("-Cprofile-generate");
332331
output.assert_ok();
333332

334333
Ok(())

tests/integration/utils/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ pub trait OutputExt {
167167
fn assert_ok(self) -> Self;
168168
fn assert_error(self) -> Self;
169169

170+
fn assert_stderr_contains(&self, needle: &str);
171+
170172
fn stdout(&self) -> String;
171173
fn stderr(&self) -> String;
172174
}
@@ -190,6 +192,13 @@ impl OutputExt for Output {
190192
self
191193
}
192194

195+
fn assert_stderr_contains(&self, needle: &str) {
196+
let stderr = self.stderr();
197+
if !stderr.contains(needle) {
198+
panic!("STDERR\n{stderr}\nDOES NOT CONTAIN\n{needle}");
199+
}
200+
}
201+
193202
fn stdout(&self) -> String {
194203
String::from_utf8_lossy(&self.stdout).to_string()
195204
}

0 commit comments

Comments
 (0)