summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-01-29 23:51:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-01-29 23:51:33 +0000
commit0009654e3a4b8b874ae0a6a88698e9666fc7c040 (patch)
treedfa5b9aef7d0cec0769f6cbe913ba23f1c242cbb
parentac1def1dbcc56f478f4c3505809bf8f589be49b8 (diff)
parenta9535c4695df87ead570b681c4b1f28c38ba7dc7 (diff)
downloadcts-android14-qpr2-s2-release.tar.gz
Change-Id: I41d10273c23693baf9885d4d59d7ef0ef8a666ee
-rw-r--r--tests/tests/os/src/android/os/cts/BuildTest.java66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/tests/os/src/android/os/cts/BuildTest.java b/tests/tests/os/src/android/os/cts/BuildTest.java
index 61ad53b9d01..3dcdd6b2fc1 100644
--- a/tests/tests/os/src/android/os/cts/BuildTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildTest.java
@@ -16,9 +16,6 @@
package android.os.cts;
-import static android.os.Build.VERSION.ACTIVE_CODENAMES;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
-
import android.os.Build;
import android.os.SystemProperties;
import android.platform.test.annotations.AppModeFull;
@@ -28,15 +25,12 @@ import com.android.compatibility.common.util.CddTest;
import junit.framework.TestCase;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
public class BuildTest extends TestCase {
@@ -261,66 +255,6 @@ public class BuildTest extends TestCase {
}
/**
- * Tests that check for valid values of codenames related constants.
- */
- public void testBuildCodenameConstants() {
- // CUR_DEVELOPMENT must be larger than any released version.
- Field[] fields = Build.VERSION_CODES.class.getDeclaredFields();
- List<String> activeCodenames = Arrays.asList(ACTIVE_CODENAMES);
- // Make the codenames uppercase to match the field names.
- activeCodenames.replaceAll(String::toUpperCase);
- Set<String> knownCodenames = Build.VERSION.KNOWN_CODENAMES.stream()
- .map(String::toUpperCase)
- .collect(Collectors.toSet());
- HashSet<String> declaredCodenames = new HashSet<>();
- for (Field field : fields) {
- if (field.getType().equals(int.class) && Modifier.isStatic(field.getModifiers())) {
- String fieldName = field.getName();
- final int fieldValue;
- try {
- fieldValue = field.getInt(null);
- } catch (IllegalAccessException e) {
- throw new AssertionError(e.getMessage());
- }
- declaredCodenames.add(fieldName);
- if (fieldName.equals("CUR_DEVELOPMENT")) {
- // It should be okay to change the value of this constant in future, but it
- // should at least be a conscious decision.
- assertEquals(10000, fieldValue);
- } else {
- // Remove all underscores to match build level codenames, e.g. S_V2 is Sv2.
- String fieldNameWithoutUnderscores = fieldName.replaceAll("_", "");
- if (activeCodenames.contains(fieldNameWithoutUnderscores)) {
- // This is the current development version. Note that fieldName can
- // become < CUR_DEVELOPMENT before CODENAME becomes "REL", so we
- // can't assertEquals(CUR_DEVELOPMENT, fieldValue) here.
- assertTrue("Expected " + fieldName + " value to be <= " + CUR_DEVELOPMENT
- + ", got " + fieldValue, fieldValue <= CUR_DEVELOPMENT);
- } else {
- assertTrue("Expected " + fieldName + " value to be < " + CUR_DEVELOPMENT
- + ", got " + fieldValue, fieldValue < CUR_DEVELOPMENT);
- }
- declaredCodenames.add(fieldNameWithoutUnderscores);
- assertTrue("Expected " + fieldNameWithoutUnderscores
- + " to be declared in Build.VERSION.KNOWN_CODENAMES",
- knownCodenames.contains(fieldNameWithoutUnderscores));
- }
- }
- }
-
- HashSet<String> diff = new HashSet<>(knownCodenames);
- diff.removeAll(declaredCodenames);
- assertTrue(
- "Expected all elements in Build.VERSION.KNOWN_CODENAMES to be declared in"
- + " Build.VERSION_CODES, found " + diff, diff.isEmpty());
-
- if (!Build.VERSION.CODENAME.equals("REL")) {
- assertTrue("In-development CODENAME must be declared in Build.VERSION.KNOWN_CODENAMES",
- Build.VERSION.KNOWN_CODENAMES.contains(Build.VERSION.CODENAME));
- }
- }
-
- /**
* Verify that SDK versions are bounded by both high and low expected
* values.
*/