Merge "Disallow pre-T use of userspace writable bpf map arrays with more than 1 element."
diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/TrackRecordTest.kt b/staticlibs/tests/unit/src/com/android/net/module/util/TrackRecordTest.kt
index 9fb4d8c..8e320d0 100644
--- a/staticlibs/tests/unit/src/com/android/net/module/util/TrackRecordTest.kt
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/TrackRecordTest.kt
@@ -17,6 +17,7 @@
package com.android.net.module.util
import com.android.testutils.ConcurrentInterpreter
+import com.android.testutils.INTERPRET_TIME_UNIT
import com.android.testutils.InterpretException
import com.android.testutils.InterpretMatcher
import com.android.testutils.SyntaxException
@@ -420,7 +421,7 @@
// the test code to not compile instead of throw, but it's vastly more complex and this will
// fail 100% at runtime any test that would not have compiled.
Regex("""poll\((\d+)?\)\s*(\{.*\})?""") to { i, t, r ->
- (if (r.strArg(1).isEmpty()) i.interpretTimeUnit else r.timeArg(1)).let { time ->
+ (if (r.strArg(1).isEmpty()) INTERPRET_TIME_UNIT else r.timeArg(1)).let { time ->
(t as ArrayTrackRecord<Int>.ReadHead).poll(time, makePredicate(r.strArg(2)))
}
},
diff --git a/staticlibs/tests/unit/src/com/android/testutils/TestableNetworkCallbackTest.kt b/staticlibs/tests/unit/src/com/android/testutils/TestableNetworkCallbackTest.kt
index 690ef2e..a78a078 100644
--- a/staticlibs/tests/unit/src/com/android/testutils/TestableNetworkCallbackTest.kt
+++ b/staticlibs/tests/unit/src/com/android/testutils/TestableNetworkCallbackTest.kt
@@ -322,9 +322,9 @@
TNCInterpreter.interpretTestSpec(initial = mCallback, lineShift = 1,
threadTransform = { cb -> cb.createLinkedCopy() }, spec = """
onAvailable(100) | eventually(CapabilitiesChanged(100), 1) fails
- sleep ; onCapabilitiesChanged(100) | eventually(CapabilitiesChanged(100), 2)
+ sleep ; onCapabilitiesChanged(100) | eventually(CapabilitiesChanged(100), 3)
onAvailable(101) ; onBlockedStatus(101) | eventually(BlockedStatus(100), 2) fails
- onSuspended(100) ; sleep ; onLost(100) | eventually(Lost(100), 2)
+ onSuspended(100) ; sleep ; onLost(100) | eventually(Lost(100), 3)
""")
}
}
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/ConcurrentInterpreter.kt b/staticlibs/testutils/devicetests/com/android/testutils/ConcurrentInterpreter.kt
index cbdc017..9e72f4b 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/ConcurrentInterpreter.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/ConcurrentInterpreter.kt
@@ -13,7 +13,7 @@
typealias InterpretMatcher<T> = Pair<Regex, (ConcurrentInterpreter<T>, T, MatchResult) -> Any?>
// The default unit of time for interpreted tests
-val INTERPRET_TIME_UNIT = 40L // ms
+const val INTERPRET_TIME_UNIT = 60L // ms
/**
* A small interpreter for testing parallel code.
@@ -40,10 +40,7 @@
* Some expressions already exist by default and can be used by all interpreters. Refer to
* getDefaultInstructions() below for a list and documentation.
*/
-open class ConcurrentInterpreter<T>(
- localInterpretTable: List<InterpretMatcher<T>>,
- val interpretTimeUnit: Long = INTERPRET_TIME_UNIT
-) {
+open class ConcurrentInterpreter<T>(localInterpretTable: List<InterpretMatcher<T>>) {
private val interpretTable: List<InterpretMatcher<T>> =
localInterpretTable + getDefaultInstructions()
// The last time the thread became blocked, with base System.currentTimeMillis(). This should
@@ -211,7 +208,7 @@
},
// Interpret sleep. Optional argument for the count, in INTERPRET_TIME_UNIT units.
Regex("""sleep(\((\d+)\))?""") to { i, t, r ->
- SystemClock.sleep(if (r.strArg(2).isEmpty()) i.interpretTimeUnit else r.timeArg(2))
+ SystemClock.sleep(if (r.strArg(2).isEmpty()) INTERPRET_TIME_UNIT else r.timeArg(2))
},
Regex("""(.*)\s*fails""") to { i, t, r ->
assertFails { i.interpret(r.strArg(1), t) }