Skip to content

Commit 47ee35a

Browse files
authored
Merge pull request #31 from mozilla/update-CI
Update CI runners
2 parents 9074748 + 70a6669 commit 47ee35a

4 files changed

Lines changed: 29 additions & 38 deletions

File tree

.github/workflows/rust.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ jobs:
88
strategy:
99
matrix:
1010
rust: [stable, nightly]
11-
os: [ubuntu-20.04, windows-2019, macos-10.15]
11+
os: [ubuntu-24.04, windows-2025, macos-14]
1212
type: [Release, Debug]
1313

1414
steps:
1515
- uses: actions/checkout@v2
1616

1717
- name: Install Rust
18-
run: rustup toolchain install ${{ matrix.rust }} --profile minimal --component rustfmt clippy
18+
run: |
19+
rustup toolchain install ${{ matrix.rust }} --profile minimal
20+
rustup component add rustfmt --toolchain ${{ matrix.rust }}
21+
rustup component add clippy --toolchain ${{ matrix.rust }}
1922
2023
- name: Install Dependencies (Linux)
2124
run: sudo apt-get update && sudo apt-get install libpulse-dev pulseaudio libdbus-1-dev
22-
if: matrix.os == 'ubuntu-20.04'
25+
if: matrix.os == 'ubuntu-24.04'
2326

2427
- name: Check format
2528
shell: bash
@@ -36,4 +39,5 @@ jobs:
3639
- name: Test
3740
shell: bash
3841
run: rustup run ${{ matrix.rust }} cargo test --all
39-
if: matrix.os != 'ubuntu-20.04' # setrlimit64 error in the CI container
42+
# setrlimit64 error in the CI container, macOS not supported
43+
if: matrix.os != 'ubuntu-24.04' && matrix.os != 'macos-14'

src/lib.rs

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl fmt::Display for AudioThreadPriorityError {
6868
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6969
let mut rv = write!(f, "AudioThreadPriorityError: {}", &self.message);
7070
if let Some(inner) = &self.inner {
71-
rv = write!(f, " ({})", inner);
71+
rv = write!(f, " ({inner})");
7272
}
7373
rv
7474
}
@@ -587,61 +587,54 @@ mod tests {
587587
{
588588
match promote_current_thread_to_real_time(0, 44100) {
589589
Ok(rt_prio_handle) => {
590-
demote_current_thread_from_real_time(rt_prio_handle).unwrap();
591-
assert!(true);
590+
let rv = demote_current_thread_from_real_time(rt_prio_handle);
591+
assert!(rv.is_ok());
592592
}
593593
Err(e) => {
594-
eprintln!("{}", e);
595-
assert!(false);
594+
panic!("{}", e);
596595
}
597596
}
598597
}
599598
{
600599
match promote_current_thread_to_real_time(512, 44100) {
601600
Ok(rt_prio_handle) => {
602-
demote_current_thread_from_real_time(rt_prio_handle).unwrap();
603-
assert!(true);
601+
let rv = demote_current_thread_from_real_time(rt_prio_handle);
602+
assert!(rv.is_ok());
604603
}
605604
Err(e) => {
606-
eprintln!("{}", e);
607-
assert!(false);
605+
panic!("{}", e);
608606
}
609607
}
610608
}
611609
{
612610
// Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23
613611
match promote_current_thread_to_real_time(0, 192000) {
614612
Ok(rt_prio_handle) => {
615-
demote_current_thread_from_real_time(rt_prio_handle).unwrap();
616-
assert!(true);
613+
let rv = demote_current_thread_from_real_time(rt_prio_handle);
614+
assert!(rv.is_ok());
617615
}
618616
Err(e) => {
619-
eprintln!("{}", e);
620-
assert!(false);
617+
panic!("{}", e);
621618
}
622619
}
623620
}
624621
{
625622
// Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23
626623
match promote_current_thread_to_real_time(8192, 48000) {
627624
Ok(rt_prio_handle) => {
628-
demote_current_thread_from_real_time(rt_prio_handle).unwrap();
629-
assert!(true);
625+
let rv = demote_current_thread_from_real_time(rt_prio_handle);
626+
assert!(rv.is_ok());
630627
}
631628
Err(e) => {
632-
eprintln!("{}", e);
633-
assert!(false);
629+
panic!("{}", e);
634630
}
635631
}
636632
}
637633
{
638634
match promote_current_thread_to_real_time(512, 44100) {
639-
Ok(_) => {
640-
assert!(true);
641-
}
635+
Ok(_) => {}
642636
Err(e) => {
643-
eprintln!("{}", e);
644-
assert!(false);
637+
panic!("{}", e);
645638
}
646639
}
647640
// automatically deallocated, but not demoted until the thread exits.
@@ -666,12 +659,9 @@ mod tests {
666659
{
667660
let info = get_current_thread_info().unwrap();
668661
match promote_thread_to_real_time(info, 512, 44100) {
669-
Ok(_) => {
670-
assert!(true);
671-
}
662+
Ok(_) => { }
672663
Err(e) => {
673-
eprintln!("{}", e);
674-
assert!(false);
664+
panic!("{}", e);
675665
}
676666
}
677667
}
@@ -702,12 +692,10 @@ mod tests {
702692
match promote_thread_to_real_time(info, 0, 44100) {
703693
Ok(_) => {
704694
eprintln!("thread promotion in the child from the parent succeeded");
705-
assert!(true);
706695
}
707-
Err(_) => {
708-
eprintln!("promotion Err");
696+
Err(e) => {
709697
kill(child, SIGKILL).expect("Could not kill the child?");
710-
assert!(false);
698+
panic!("{}", e);
711699
}
712700
}
713701
}

src/rt_linux.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ fn item_as_i64(i: MessageItem) -> Result<i64, AudioThreadPriorityError> {
8080
MessageItem::Int32(i) => Ok(i as i64),
8181
MessageItem::Int64(i) => Ok(i),
8282
_ => Err(AudioThreadPriorityError::new(&format!(
83-
"Property is not integer ({:?})",
84-
i
83+
"Property is not integer ({i:?})"
8584
))),
8685
}
8786
}

src/rt_mach.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn promote_current_thread_to_real_time_internal(
155155
));
156156
}
157157

158-
info!("thread {} bumped to real time priority.", tid);
158+
info!("thread {tid} bumped to real time priority.");
159159
}
160160

161161
Ok(rt_priority_handle)

0 commit comments

Comments
 (0)