tests: arm: interrupt: fix side effect in assertion

Read a volatile status into a local variable to
discard a side effect in assertion. This fixes
an issue reported by Coverity: CID: 214210.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2020-09-09 09:53:52 +02:00 committed by Anas Nashif
commit c6cf8d1673

View file

@ -153,6 +153,8 @@ void set_regs_with_known_pattern(void)
void test_arm_esf_collection(void)
{
int test_validation_rv;
/* if the check in the fault handler succeeds,
* this will be set to TC_PASS
*/
@ -178,7 +180,10 @@ void test_arm_esf_collection(void)
(k_thread_entry_t)set_regs_with_known_pattern,
NULL, NULL, NULL, K_PRIO_COOP(PRIORITY), 0,
K_NO_WAIT);
zassert_not_equal(esf_validation_rv, TC_FAIL,
test_validation_rv = esf_validation_rv;
zassert_not_equal(test_validation_rv, TC_FAIL,
"ESF fault collection failed");
}