threadnetwork: Avoid execute command if service does not exist
We might run VTS when the thread_network service is not available. This
patch prevents shell commands from being executed if the service is
absent.
Bug: 374009923
Bug: 355317617
Test: atest VtsHalThreadNetworkTargetTest
Change-Id: I94dd7e2e7585e061f53291c47e46841e5e670b6c
diff --git a/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.xml b/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.xml
index 0525876..b5eb843 100644
--- a/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.xml
+++ b/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.xml
@@ -13,11 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+
<configuration description="Runs VtsHalThreadNetworkTargetTest.">
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
- <option name="run-command" value="cmd thread_network force-stop-ot-daemon enabled" />
+ <option name="run-command" value="if pm list features |grep 'android.hardware.thread_network'; then cmd thread_network force-stop-ot-daemon enabled; fi" />
<option name="run-command" value="cmd bluetooth_manager enable" />
- <option name="teardown-command" value="cmd thread_network force-stop-ot-daemon disabled" />
+ <option name="teardown-command" value="if pm list features |grep 'android.hardware.thread_network'; then cmd thread_network force-stop-ot-daemon disabled; fi" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />