diff --git a/src/core/diags/factory_diags.cpp b/src/core/diags/factory_diags.cpp index 12bfefb0e..783b845f8 100644 --- a/src/core/diags/factory_diags.cpp +++ b/src/core/diags/factory_diags.cpp @@ -288,6 +288,8 @@ otError Diags::ProcessStart(uint8_t aArgsLength, char *aArgs[], char *aOutput, s otError error = OT_ERROR_NONE; + VerifyOrExit(!Get().IsUp(), error = OT_ERROR_INVALID_STATE); + otPlatDiagChannelSet(mChannel); otPlatDiagTxPowerSet(mTxPower); diff --git a/tests/scripts/expect/cli-misc.exp b/tests/scripts/expect/cli-misc.exp index 999efd1e5..65992bb19 100755 --- a/tests/scripts/expect/cli-misc.exp +++ b/tests/scripts/expect/cli-misc.exp @@ -164,4 +164,7 @@ expect "0:0:0:0::/64 s low" send "route remove ::/64\n" expect "Done" +send "diag start\n" +expect ": InvalidState" + dispose_all