summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2022-01-07 08:01:07 -0800
committerMaciej Żenczykowski <maze@google.com>2022-01-07 08:06:36 -0800
commitd3c14e9e92057c1fc9921b74d476ea9332e481b8 (patch)
tree75948bb70e6ac8e85b32b3665be67519774a061c
parent2d39f5c866a740dd3db76487c0aef8f39127841e (diff)
downloadtests-d3c14e9e92057c1fc9921b74d476ea9332e481b8.tar.gz
net-test: when running under Android run inside netns if possible
Will hopefully reduce flake rate... Bug: 185330868 Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I233e79c637cb62a145bcf9eaeab08c219a7bd5df
-rwxr-xr-xnet/test/all_tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/test/all_tests.py b/net/test/all_tests.py
index 17d9701..2305354 100755
--- a/net/test/all_tests.py
+++ b/net/test/all_tests.py
@@ -15,6 +15,7 @@
# limitations under the License.
import importlib
+import os
import sys
import unittest
@@ -48,8 +49,9 @@ test_modules = [
]
if __name__ == '__main__':
- # Check whether ADB over TCP is occupying TCP port 5555.
- if namespace.HasEstablishedTcpSessionOnPort(5555):
+ # Check whether ADB over TCP is occupying TCP port 5555,
+ # or if we're on a real Android device
+ if os.path.isdir('/system') or namespace.HasEstablishedTcpSessionOnPort(5555):
namespace.IfPossibleEnterNewNetworkNamespace()
# First, run InjectTests on all modules, to ensure that any parameterized
# tests in those modules are injected.