Add sustained performance test results warning am: 00168f1321 am: 47c4f3d15c am: 85e4ba720e -s ours am: 65ad9ebaf2
am: 6b8c275549
Change-Id: I16a9cbae58b4de4e2c907b89f815f78de43b0748
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
index 6deaed4..4a4ea98 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
@@ -271,12 +271,12 @@
continue;
}
}
- if ((i > 0) && ((i % 8 ) == 0)) {
+ if ((i >= 64) && ((i % 8 ) == 0)) {
keyGenerator.init(spec, rng);
SecretKey key = keyGenerator.generateKey();
assertEquals(i, TestUtils.getKeyInfo(key).getKeySize());
assertEquals((i + 7) / 8, rng.getOutputSizeBytes());
- } else {
+ } else if (i >= 64) {
try {
keyGenerator.init(spec, rng);
fail();
diff --git a/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java b/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
index 7d5742e..69f3ee8 100644
--- a/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
+++ b/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
@@ -344,24 +344,25 @@
return;
}
- IConnectionStatus wifiStatus = new WifiStatus(mContext);
- if (!wifiStatus.isEnabled()) {
- throw new Error("Wifi is not enabled, please enable Wifi to run tests.");
+ IConnectionStatus connectionStatus = new ConnectionStatus(mContext);
+ if (!connectionStatus.isAvailable()) {
+ throw new Error("Network is not available, reason: " +
+ connectionStatus.getNotConnectedReason());
}
- // If Wifi is not connected, recheck the status a few times.
+
+ // If device is not online, recheck the status a few times.
int retries = 0;
- while (!wifiStatus.isConnected()) {
+ while (!connectionStatus.isConnected()) {
if (retries++ >= CONNECTION_RETRIES) {
- wifiStatus.printConnectionInfo();
- throw new Error("Wifi is not connected, reason: " +
- wifiStatus.getNotConnectedReason());
+ throw new Error("Device is not online, reason: " +
+ connectionStatus.getNotConnectedReason());
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
- wifiStatus.testConnection(videoUrl);
+ connectionStatus.testConnection(videoUrl);
mSessionId = openSession(drm);
mMediaCodecPlayer = new MediaCodecClearKeyPlayer(
diff --git a/tests/tests/media/src/android/media/cts/WifiStatus.java b/tests/tests/media/src/android/media/cts/ConnectionStatus.java
similarity index 77%
rename from tests/tests/media/src/android/media/cts/WifiStatus.java
rename to tests/tests/media/src/android/media/cts/ConnectionStatus.java
index c2577f1..37fc75e 100644
--- a/tests/tests/media/src/android/media/cts/WifiStatus.java
+++ b/tests/tests/media/src/android/media/cts/ConnectionStatus.java
@@ -20,8 +20,6 @@
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
import android.util.Log;
import java.io.BufferedReader;
@@ -32,19 +30,17 @@
/**
* A class that implements IConnectionStatus interface
- * to report and test Wifi connection.
+ * to report and test connection status.
*/
-public class WifiStatus implements IConnectionStatus {
+public class ConnectionStatus implements IConnectionStatus {
- private static final String TAG = "WifiStatus";
+ private static final String TAG = "ConnectionStatus";
private ConnectivityManager mConnectivityManager;
- private WifiManager mWifiManager;
- public WifiStatus(Context context) {
+ public ConnectionStatus(Context context) {
mConnectivityManager =
(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
- mWifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
}
public String getNotConnectedReason() {
@@ -52,7 +48,7 @@
if (networkInfo != null) {
return networkInfo.getReason();
} else {
- return "Cannot get network info";
+ return "Network info is not available.";
}
}
@@ -66,22 +62,6 @@
return (networkInfo != null) && networkInfo.isConnected();
}
- public boolean isEnabled() {
- return mWifiManager.isWifiEnabled();
- }
-
- public void printConnectionInfo() {
- WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
- if (wifiInfo == null) {
- throw new Error("Fail to get Wifi connection info");
- }
-
- Log.d(TAG, "ssid=" + wifiInfo.getSSID());
- Log.d(TAG, "frequency=" + wifiInfo.getFrequency() + " " + WifiInfo.FREQUENCY_UNITS);
- Log.d(TAG, "rssi=" + wifiInfo.getRssi() + " dBm");
- Log.d(TAG, "link speed=" + wifiInfo.getLinkSpeed() + " " + WifiInfo.LINK_SPEED_UNITS);
- }
-
/**
* Print lines.
*
@@ -152,14 +132,6 @@
}
public void testConnection(Uri uri) {
- final String GOOG = "www.google.com";
-
- if (pingTest(GOOG)) {
- Log.d(TAG, "Successfully pinged " + GOOG);
- } else {
- Log.e(TAG, "Failed to ping " + GOOG);
- }
-
if (pingTest(uri.getHost())) {
Log.d(TAG, "Successfully pinged " + uri.getHost());
} else {
diff --git a/tests/tests/media/src/android/media/cts/IConnectionStatus.java b/tests/tests/media/src/android/media/cts/IConnectionStatus.java
index 39e2781..17d5ff7 100644
--- a/tests/tests/media/src/android/media/cts/IConnectionStatus.java
+++ b/tests/tests/media/src/android/media/cts/IConnectionStatus.java
@@ -29,10 +29,6 @@
public boolean isConnected();
- public boolean isEnabled();
-
- public void printConnectionInfo();
-
public void testConnection(Uri uri);
}
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 5397fc6a..4dc87b1 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -48,3 +48,34 @@
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
+
+# platform version check (b/32056228)
+# ============================================================
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := cts-platform-version-check
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+cts_platform_version_path := cts/tests/tests/os/assets/platform_versions.txt
+cts_platform_version_string := $(shell cat $(cts_platform_version_path))
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE) : $(cts_platform_version_path) build/core/version_defaults.mk
+ $(hide) if [ -z "$(findstring $(PLATFORM_VERSION),$(cts_platform_version_string))" ]; then \
+ echo "============================================================" 1>&2; \
+ echo "Could not find version \"$(PLATFORM_VERSION)\" in CTS platform version file:" 1>&2; \
+ echo "" 1>&2; \
+ echo " $(cts_platform_version_path)" 1>&2; \
+ echo "" 1>&2; \
+ echo "Most likely PLATFORM_VERSION in build/core/version_defaults.mk" 1>&2; \
+ echo "has changed and a new version must be added to this CTS file." 1>&2; \
+ echo "============================================================" 1>&2; \
+ exit 1; \
+ fi
+ @mkdir -p $(dir $@)
+ echo $(cts_platform_version_string) > $@
diff --git a/tests/tests/os/assets/platform_versions.txt b/tests/tests/os/assets/platform_versions.txt
new file mode 100644
index 0000000..6f9c237
--- /dev/null
+++ b/tests/tests/os/assets/platform_versions.txt
@@ -0,0 +1,3 @@
+7.1
+7.1.1
+7.1.2
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index 66066e9..d06171b 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -16,10 +16,16 @@
package android.os.cts;
+import android.content.res.AssetManager;
import android.os.Build;
import android.platform.test.annotations.RestrictedBuildTest;
+import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -29,17 +35,16 @@
public class BuildVersionTest extends TestCase {
private static final String LOG_TAG = "BuildVersionTest";
- private static final Set<String> EXPECTED_RELEASES =
- new HashSet<String>(Arrays.asList("7.1","7.1.1"));
private static final int EXPECTED_SDK = 25;
private static final String EXPECTED_BUILD_VARIANT = "user";
private static final String EXPECTED_TAG = "release-keys";
+ private static final String PLATFORM_VERSIONS_FILE = "platform_versions.txt";
@SuppressWarnings("deprecation")
@RestrictedBuildTest
public void testReleaseVersion() {
// Applications may rely on the exact release version
- assertAnyOf("BUILD.VERSION.RELEASE", Build.VERSION.RELEASE, EXPECTED_RELEASES);
+ assertAnyOf("BUILD.VERSION.RELEASE", Build.VERSION.RELEASE, getExpectedReleases());
assertEquals("Build.VERSION.SDK", "" + EXPECTED_SDK, Build.VERSION.SDK);
assertEquals("Build.VERSION.SDK_INT", EXPECTED_SDK, Build.VERSION.SDK_INT);
}
@@ -94,4 +99,20 @@
", should be one of: " + permittedValues);
}
}
+
+ private Set<String> getExpectedReleases() {
+ Set<String> expectedReleases = new HashSet<String>();
+ final AssetManager assets =
+ InstrumentationRegistry.getInstrumentation().getTargetContext().getAssets();
+ String line;
+ try (BufferedReader br =
+ new BufferedReader(new InputStreamReader(assets.open(PLATFORM_VERSIONS_FILE)))) {
+ while ((line = br.readLine()) != null) {
+ expectedReleases.add(line);
+ }
+ } catch (IOException e) {
+ fail("Could not open file " + PLATFORM_VERSIONS_FILE + " to run test");
+ }
+ return expectedReleases;
+ }
}