diff options
author | Christopher Dombroski <cdombroski@google.com> | 2023-04-03 15:49:31 -0700 |
---|---|---|
committer | Chris Dombroski <cdombroski@google.com> | 2023-04-03 23:03:07 +0000 |
commit | 83236b4f91cb954fba79af1b2a681839a3c14c3d (patch) | |
tree | 135b8377b66732afefc2e34f57da713ba7de2550 | |
parent | 3b0ae35d3b82bb80ada4cdab12dbd7e1b55ee44d (diff) | |
download | platform_testing-83236b4f91cb954fba79af1b2a681839a3c14c3d.tar.gz |
Fix NPE on STS BL
Bug: 272351660
Test: presubmit
Change-Id: I26237cb210693a3a1a5be69bf5ac8b403e082c7f
Merged-In: I26237cb210693a3a1a5be69bf5ac8b403e082c7f
2 files changed, 12 insertions, 0 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 83ca09662..af1327125 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 @@ -34,6 +34,8 @@ import java.util.Optional; /** The device-side implementation of StsLogic. */ public class StsExtraBusinessLogicTestCase extends ExtraBusinessLogicTestCase implements StsLogic { + private static final String LOG_TAG = StsExtraBusinessLogicTestCase.class.getSimpleName(); + private LocalDate deviceSpl = null; @Rule public DescriptionProvider descriptionProvider = new DescriptionProvider(); @@ -46,6 +48,10 @@ 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"); + if (stsDynamicPlan == null) { + Log.w(LOG_TAG, "cannot get STS dynamic plan; this likely isn't run in STS"); + return List.of(); + } return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan); } 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 80c5cc95b..e93166dd4 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 @@ -35,6 +35,8 @@ import java.util.Optional; public class StsExtraBusinessLogicHostTestBase extends ExtraBusinessLogicHostTestBase implements StsLogic { + private static final String LOG_TAG = StsExtraBusinessLogicHostTestBase.class.getSimpleName(); + private LocalDate deviceSpl = null; @Rule public DescriptionProvider descriptionProvider = new DescriptionProvider(); @@ -47,6 +49,10 @@ 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"); + if (stsDynamicPlan == null) { + Log.w(LOG_TAG, "cannot get STS dynamic plan; this likely isn't run in STS"); + return List.of(); + } return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan); } |