diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-29 23:51:33 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-29 23:51:33 +0000 |
commit | 0009654e3a4b8b874ae0a6a88698e9666fc7c040 (patch) | |
tree | dfa5b9aef7d0cec0769f6cbe913ba23f1c242cbb | |
parent | ac1def1dbcc56f478f4c3505809bf8f589be49b8 (diff) | |
parent | a9535c4695df87ead570b681c4b1f28c38ba7dc7 (diff) | |
download | cts-android14-qpr2-release.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/26049105'] into 24Q1-release.android-14.0.0_r37android-14.0.0_r36android-14.0.0_r35android-14.0.0_r34android-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android14-qpr2-s5-releaseandroid14-qpr2-s4-releaseandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Change-Id: I41d10273c23693baf9885d4d59d7ef0ef8a666ee
-rw-r--r-- | tests/tests/os/src/android/os/cts/BuildTest.java | 66 |
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. */ |