Skip to content

Commit 333f505

Browse files
test: only test immediate park policy
1 parent 215871d commit 333f505

File tree

4 files changed

+25
-109
lines changed

4 files changed

+25
-109
lines changed

src/parking/barging/lock_api/mutex.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,42 +74,25 @@ impl<T: ?Sized, Ps: Park, Pq: Park> LockData for Mutex<T, Ps, Pq> {
7474

7575
#[cfg(test)]
7676
mod test {
77-
use crate::parking::barging::lock_api::{immediate, yields};
77+
use crate::parking::barging::lock_api::immediate;
7878
use crate::test::tests;
7979

8080
type Mutex<T> = immediate::Mutex<T>;
81-
82-
type ImmediateMutex<T> = immediate::Mutex<T>;
83-
type YieldThenParkMutex<T> = yields::Mutex<T>;
81+
type ImmediateParkMutex<T> = immediate::Mutex<T>;
8482

8583
#[test]
8684
fn lots_and_lots_lock_immediate_park() {
87-
tests::lots_and_lots_lock::<ImmediateMutex<_>>();
88-
}
89-
90-
#[test]
91-
fn lots_and_lots_lock_yield_then_park() {
92-
tests::lots_and_lots_lock::<YieldThenParkMutex<_>>();
85+
tests::lots_and_lots_lock::<ImmediateParkMutex<_>>();
9386
}
9487

9588
#[test]
9689
fn lots_and_lots_try_lock_immediate_park() {
97-
tests::lots_and_lots_try_lock::<ImmediateMutex<_>>();
98-
}
99-
100-
#[test]
101-
fn lots_and_lots_try_lock_yield_then_park() {
102-
tests::lots_and_lots_try_lock::<YieldThenParkMutex<_>>();
90+
tests::lots_and_lots_try_lock::<ImmediateParkMutex<_>>();
10391
}
10492

10593
#[test]
10694
fn lots_and_lots_mixed_lock_immediate_park() {
107-
tests::lots_and_lots_mixed_lock::<ImmediateMutex<_>>();
108-
}
109-
110-
#[test]
111-
fn lots_and_lots_mixed_lock_yield_then_park() {
112-
tests::lots_and_lots_mixed_lock::<YieldThenParkMutex<_>>();
95+
tests::lots_and_lots_mixed_lock::<ImmediateParkMutex<_>>();
11396
}
11497

11598
#[test]

src/parking/barging/mutex.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,11 @@ impl<T: ?Sized, Ps, Pq> AsDerefMut for MutexGuard<'_, T, Ps, Pq> {
567567

568568
#[cfg(all(not(loom), test))]
569569
mod test {
570-
use crate::parking::barging::{immediate, yields};
570+
use crate::parking::barging::immediate;
571571
use crate::test::tests;
572572

573573
type Mutex<T> = immediate::Mutex<T>;
574-
575-
type ImmediateMutex<T> = immediate::Mutex<T>;
576-
type YieldThenParkMutex<T> = yields::Mutex<T>;
574+
type ImmediateParkMutex<T> = immediate::Mutex<T>;
577575

578576
#[test]
579577
fn node_waiter_drop_does_not_matter() {
@@ -582,32 +580,17 @@ mod test {
582580

583581
#[test]
584582
fn lots_and_lots_lock_immediate_park() {
585-
tests::lots_and_lots_lock::<ImmediateMutex<_>>();
586-
}
587-
588-
#[test]
589-
fn lots_and_lots_lock_yield_then_park() {
590-
tests::lots_and_lots_lock::<YieldThenParkMutex<_>>();
583+
tests::lots_and_lots_lock::<ImmediateParkMutex<_>>();
591584
}
592585

593586
#[test]
594587
fn lots_and_lots_try_lock_immediate_park() {
595-
tests::lots_and_lots_try_lock::<ImmediateMutex<_>>();
596-
}
597-
598-
#[test]
599-
fn lots_and_lots_try_lock_yield_then_park() {
600-
tests::lots_and_lots_try_lock::<YieldThenParkMutex<_>>();
588+
tests::lots_and_lots_try_lock::<ImmediateParkMutex<_>>();
601589
}
602590

603591
#[test]
604592
fn lots_and_lots_mixed_lock_immediate_park() {
605-
tests::lots_and_lots_mixed_lock::<ImmediateMutex<_>>();
606-
}
607-
608-
#[test]
609-
fn lots_and_lots_mixed_lock_yield_then_park() {
610-
tests::lots_and_lots_mixed_lock::<YieldThenParkMutex<_>>();
593+
tests::lots_and_lots_mixed_lock::<ImmediateParkMutex<_>>();
611594
}
612595

613596
#[test]

src/parking/raw/mutex.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,11 @@ impl<T: ?Sized, P> crate::test::LockData for Mutex<T, P> {
542542

543543
#[cfg(all(not(loom), test))]
544544
mod test {
545-
use crate::parking::raw::{immediate, yields};
545+
use crate::parking::raw::immediate;
546546
use crate::test::tests;
547547

548548
type Mutex<T> = immediate::Mutex<T>;
549-
550-
type ImmediateMutex<T> = immediate::Mutex<T>;
551-
type YieldThenParkMutex<T> = yields::Mutex<T>;
549+
type ImmediateParkMutex<T> = immediate::Mutex<T>;
552550

553551
#[test]
554552
fn node_waiter_drop_does_not_matter() {
@@ -557,32 +555,17 @@ mod test {
557555

558556
#[test]
559557
fn lots_and_lots_lock_immediate_park() {
560-
tests::lots_and_lots_lock::<ImmediateMutex<_>>();
561-
}
562-
563-
#[test]
564-
fn lots_and_lots_lock_yield_then_park() {
565-
tests::lots_and_lots_lock::<YieldThenParkMutex<_>>();
558+
tests::lots_and_lots_lock::<ImmediateParkMutex<_>>();
566559
}
567560

568561
#[test]
569562
fn lots_and_lots_try_lock_immediate_park() {
570-
tests::lots_and_lots_try_lock::<ImmediateMutex<_>>();
571-
}
572-
573-
#[test]
574-
fn lots_and_lots_try_lock_yield_then_park() {
575-
tests::lots_and_lots_try_lock::<YieldThenParkMutex<_>>();
563+
tests::lots_and_lots_try_lock::<ImmediateParkMutex<_>>();
576564
}
577565

578566
#[test]
579567
fn lots_and_lots_mixed_lock_immediate_park() {
580-
tests::lots_and_lots_mixed_lock::<ImmediateMutex<_>>();
581-
}
582-
583-
#[test]
584-
fn lots_and_lots_mixed_lock_yield_then_park() {
585-
tests::lots_and_lots_mixed_lock::<YieldThenParkMutex<_>>();
568+
tests::lots_and_lots_mixed_lock::<ImmediateParkMutex<_>>();
586569
}
587570

588571
#[test]

src/parking/raw/thread_local.rs

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -605,18 +605,15 @@ impl<T: ?Sized, P: Park> TryLockThen for MutexUnchecked<T, P> {
605605

606606
#[cfg(all(not(loom), test))]
607607
mod test {
608-
use crate::parking::park::{ImmediatePark, YieldThenPark};
608+
use crate::parking::park::ImmediatePark;
609609
use crate::parking::raw::MutexNode;
610610
use crate::test::tests;
611611

612612
type MutexPanic<T> = super::MutexPanic<T, ImmediatePark>;
613-
type MutexUnchecked<T> = super::MutexUnchecked<T, ImmediatePark>;
614-
615-
type ImmediateMutexPanic<T> = super::MutexPanic<T, ImmediatePark>;
616-
type YieldThenParkMutexPanic<T> = super::MutexPanic<T, YieldThenPark>;
613+
type ImmediateParkMutexPanic<T> = super::MutexPanic<T, ImmediatePark>;
617614

618-
type ImmediateMutexUnchecked<T> = super::MutexUnchecked<T, ImmediatePark>;
619-
type YieldThenParkMutexUnchecked<T> = super::MutexUnchecked<T, YieldThenPark>;
615+
type MutexUnchecked<T> = super::MutexUnchecked<T, ImmediatePark>;
616+
type ImmediateParkMutexUnchecked<T> = super::MutexUnchecked<T, ImmediatePark>;
620617

621618
#[test]
622619
fn ref_cell_node_drop_does_not_matter() {
@@ -626,62 +623,32 @@ mod test {
626623

627624
#[test]
628625
fn lots_and_lots_lock_immediate_park() {
629-
tests::lots_and_lots_lock::<ImmediateMutexPanic<_>>();
630-
}
631-
632-
#[test]
633-
fn lots_and_lots_lock_yield_then_park() {
634-
tests::lots_and_lots_lock::<YieldThenParkMutexPanic<_>>();
626+
tests::lots_and_lots_lock::<ImmediateParkMutexPanic<_>>();
635627
}
636628

637629
#[test]
638630
fn lots_and_lots_lock_immediate_park_unchecked() {
639-
tests::lots_and_lots_lock::<ImmediateMutexUnchecked<_>>();
640-
}
641-
642-
#[test]
643-
fn lots_and_lots_lock_yield_then_park_unchecked() {
644-
tests::lots_and_lots_lock::<YieldThenParkMutexUnchecked<_>>();
631+
tests::lots_and_lots_lock::<ImmediateParkMutexUnchecked<_>>();
645632
}
646633

647634
#[test]
648635
fn lots_and_lots_try_lock_immediate_park() {
649-
tests::lots_and_lots_try_lock::<ImmediateMutexPanic<_>>();
636+
tests::lots_and_lots_try_lock::<ImmediateParkMutexPanic<_>>();
650637
}
651638

652639
#[test]
653640
fn lots_and_lots_try_lock_immediate_park_unchecked() {
654-
tests::lots_and_lots_try_lock::<ImmediateMutexUnchecked<_>>();
655-
}
656-
657-
#[test]
658-
fn lots_and_lots_try_lock_yield_then_park() {
659-
tests::lots_and_lots_try_lock::<YieldThenParkMutexPanic<_>>();
660-
}
661-
662-
#[test]
663-
fn lots_and_lots_try_lock_yield_then_park_unchecked() {
664-
tests::lots_and_lots_try_lock::<YieldThenParkMutexUnchecked<_>>();
641+
tests::lots_and_lots_try_lock::<ImmediateParkMutexUnchecked<_>>();
665642
}
666643

667644
#[test]
668645
fn lots_and_lots_mixed_lock_immediate_park() {
669-
tests::lots_and_lots_mixed_lock::<ImmediateMutexPanic<_>>();
646+
tests::lots_and_lots_mixed_lock::<ImmediateParkMutexPanic<_>>();
670647
}
671648

672649
#[test]
673650
fn lots_and_lots_mixed_lock_immediate_park_unchecked() {
674-
tests::lots_and_lots_mixed_lock::<ImmediateMutexUnchecked<_>>();
675-
}
676-
677-
#[test]
678-
fn lots_and_lots_mixed_lock_yield_then_park() {
679-
tests::lots_and_lots_mixed_lock::<YieldThenParkMutexPanic<_>>();
680-
}
681-
682-
#[test]
683-
fn lots_and_lots_mixed_lock_yield_then_park_unchecked() {
684-
tests::lots_and_lots_mixed_lock::<YieldThenParkMutexUnchecked<_>>();
651+
tests::lots_and_lots_mixed_lock::<ImmediateParkMutexUnchecked<_>>();
685652
}
686653

687654
#[test]

0 commit comments

Comments
 (0)