summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/launcher3/util
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2018-12-11 17:59:36 -0800
committervadimt <vadimt@google.com>2018-12-17 14:41:20 -0800
commit00d42552725a215e4b98c84e1238a0039582286b (patch)
tree7a34b2b829bc7e96fec8b1c9fd6a00b182d198fb /tests/src/com/android/launcher3/util
parent381a75c19497342c1ffe62aa6553425231eb3da5 (diff)
downloadandroid_packages_apps_Trebuchet-00d42552725a215e4b98c84e1238a0039582286b.tar.gz
android_packages_apps_Trebuchet-00d42552725a215e4b98c84e1238a0039582286b.tar.bz2
android_packages_apps_Trebuchet-00d42552725a215e4b98c84e1238a0039582286b.zip
Adding tests that would reliably reproduce shifted search.
This would guaranteed to repro b/118441555 before it was fixed. The test doesn't use the most powerful feature of race condition reproducer, which is enumerating all possible event sequences. Instead, it uses explicit repro sequences, which makes the test much faster. Bug: 120628042 Test: The added test Change-Id: I89a7a9964f160a8a20ba3d9dda2f248237713014
Diffstat (limited to 'tests/src/com/android/launcher3/util')
-rw-r--r--tests/src/com/android/launcher3/util/RaceConditionReproducer.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/src/com/android/launcher3/util/RaceConditionReproducer.java b/tests/src/com/android/launcher3/util/RaceConditionReproducer.java
index c4350de0b..316e40d82 100644
--- a/tests/src/com/android/launcher3/util/RaceConditionReproducer.java
+++ b/tests/src/com/android/launcher3/util/RaceConditionReproducer.java
@@ -43,6 +43,11 @@ import java.util.concurrent.TimeUnit;
* executing events in previously unseen order. It does it by postponing execution of threads that
* would lead to an already seen sequence.
*
+ * If an event A occurs before event B in the sequence, this is how execution order looks like:
+ * Events: ... A ... B ...
+ * Events and instructions, guaranteed order:
+ * (instructions executed prior to A) A ... B (instructions executed after B)
+ *
* Each iteration has 3 parts (phases).
* Phase 1. Picking a previously seen event subsequence that we believe can have previously unseen
* continuations. Reproducing this sequence by pausing threads that would lead to other sequences.
@@ -178,6 +183,10 @@ public class RaceConditionReproducer implements RaceConditionTracker.EventProces
mReproString = reproString;
}
+ public RaceConditionReproducer(String... reproSequence) {
+ this(String.join("|", reproSequence));
+ }
+
public synchronized String getCurrentSequenceString() {
return mCurrentSequence.toString();
}