diff options
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); } |