diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-16 05:22:08 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-16 05:22:08 +0000 |
commit | ad7dd09bbb15725b71f5808d9c993f5e18f44c40 (patch) | |
tree | 25dfcc780abd4ae33dc8366ab57a6721ad011d88 | |
parent | 68abbff8fc44c8ee85eacb00b4544c02946f0a5d (diff) | |
parent | 3bd45969acd5a25c7891c982206bb06ed5dcecd9 (diff) | |
download | platform_testing-ad7dd09bbb15725b71f5808d9c993f5e18f44c40.tar.gz |
Snap for 8188784 from 3bd45969acd5a25c7891c982206bb06ed5dcecd9 to mainline-ipsec-releaseandroid-mainline-12.0.0_r88android12-mainline-ipsec-release
Change-Id: Ib62296edb32465ed769a9b75eb6cb27a8a9c7f92
3 files changed, 41 insertions, 26 deletions
diff --git a/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java b/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java index f50c60702..5f53362d4 100644 --- a/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java +++ b/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java @@ -46,15 +46,7 @@ public class StsExtraBusinessLogicTestCase extends ExtraBusinessLogicTestCase im // set in test/sts/tools/sts-tradefed/res/config/sts-base-dynamic-*.xml String stsDynamicPlan = InstrumentationRegistry.getArguments().getString("sts-dynamic-plan"); - switch (stsDynamicPlan) { - case "incremental": - return StsLogic.STS_EXTRA_BUSINESS_LOGIC_INCREMENTAL; - case "full": - return StsLogic.STS_EXTRA_BUSINESS_LOGIC_FULL; - default: - throw new RuntimeException( - "Could not find Dynamic STS plan in InstrumentationRegistry arguments"); - } + return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan); } @Override diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java index 68132f93e..c31f80cd2 100644 --- a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java +++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java @@ -46,14 +46,7 @@ public class StsExtraBusinessLogicHostTestBase extends ExtraBusinessLogicHostTes public List<String> getExtraBusinessLogics() { // set in test/sts/tools/sts-tradefed/res/config/sts-base-dynamic-*.xml String stsDynamicPlan = getBuild().getBuildAttributes().get("sts-dynamic-plan"); - switch (stsDynamicPlan) { - case "incremental": - return StsLogic.STS_EXTRA_BUSINESS_LOGIC_INCREMENTAL; - case "full": - return StsLogic.STS_EXTRA_BUSINESS_LOGIC_FULL; - default: - throw new RuntimeException("Could not find Dynamic STS plan in build attributes"); - } + return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan); } @Override diff --git a/libraries/sts-common-util/util/src/com/android/sts/common/util/StsLogic.java b/libraries/sts-common-util/util/src/com/android/sts/common/util/StsLogic.java index 35582d331..8dd749c0f 100644 --- a/libraries/sts-common-util/util/src/com/android/sts/common/util/StsLogic.java +++ b/libraries/sts-common-util/util/src/com/android/sts/common/util/StsLogic.java @@ -52,6 +52,11 @@ public interface StsLogic { "incremental", }); + // intentionally empty because declaredSpl and incremental skipping is not desired when + // developing STS tests. + List<String> STS_EXTRA_BUSINESS_LOGIC_DEVELOP = Arrays.asList(new String[] { + }); + Description getTestDescription(); LocalDate getPlatformSpl(); @@ -62,6 +67,20 @@ public interface StsLogic { LocalDate getReleaseBulletinSpl(); + static List<String> getExtraBusinessLogicForPlan(String stsDynamicPlan) { + switch (stsDynamicPlan) { + case "incremental": + return STS_EXTRA_BUSINESS_LOGIC_INCREMENTAL; + case "full": + return STS_EXTRA_BUSINESS_LOGIC_FULL; + case "develop": + return STS_EXTRA_BUSINESS_LOGIC_DEVELOP; + default: + throw new RuntimeException( + "Could not find Dynamic STS plan in InstrumentationRegistry arguments"); + } + } + default long[] getCveBugIds() { AsbSecurityTest annotation = getTestDescription().getAnnotation(AsbSecurityTest.class); if (annotation == null) { @@ -203,16 +222,27 @@ public interface StsLogic { return false; } - LocalDate releaseBulletinSpl = getReleaseBulletinSpl(); LocalDate minTestSpl = getMinTestSpl(); - if (releaseBulletinSpl != null && !isBugSplDataKnownMissing()) { - // assert that the test has a known SPL when we expect the data to be fresh - assertNotNull("Unknown SPL for new CVE", minTestSpl); - - // set the days to be the same so we only compare year-month - releaseBulletinSpl = releaseBulletinSpl.withDayOfMonth(minTestSpl.getDayOfMonth()); - // the test SPL can't be equal to or after the release bulletin SPL - assertFalse("Newer SPL than release bulletin", releaseBulletinSpl.isBefore(minTestSpl)); + if (!isBugSplDataKnownMissing()) { + LocalDate releaseBulletinSpl = getReleaseBulletinSpl(); + if (releaseBulletinSpl != null) { + // this is a QA environment + + // assert that the test has a known SPL when we expect the data to be fresh + assertNotNull("Unknown SPL for new CVE", minTestSpl); + + // set the days to be the same so we only compare year-month + releaseBulletinSpl = releaseBulletinSpl.withDayOfMonth(minTestSpl.getDayOfMonth()); + // the test SPL can't be equal to or after the release bulletin SPL + assertFalse( + "Newer SPL than release bulletin", releaseBulletinSpl.isBefore(minTestSpl)); + } else { + // we are in a live environment; don't run tests that have their SPL deferred + if (minTestSpl == null) { + // can't find the test SPL for this ASB test; skip + return true; + } + } } if (minTestSpl == null) { // no SPL for this test; run normally |