Page MenuHomePhabricator

Add the missing const in the test framework and test suites to reduce RAM usage.
Closed, InvalidPublic

Description

This task is to add the missing const in the test framework and test suites to reduce RAM usage.

The "static struct test_t" variables could be const all over the test suites.

Also the set_testsuite(...) function, which used to register the test suites, need to be modified to avoid compiler warning.

This task is related to this comment:
https://review.trustedfirmware.org/#/c/287/3/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c@23

Event Timeline

tamasban triaged this task as Low priority.Oct 25 2018, 12:22 PM
tamasban created this task.
mmorenobarm renamed this task from Use const where possible to reduce RAM usage to Add the missing const in the test framework and test suites to reduce RAM usage..Oct 25 2018, 2:54 PM
mmorenobarm updated the task description. (Show Details)
mmorenobarm added a comment.EditedNov 15 2018, 10:52 AM

The "struct test_t" is declared as follows in the test/framework/test_framework.h:42

struct test_t {
    TEST_FUN * const test;     /*!< Test function to call */
    const char *name;          /*!< Test name */
    const char *desc;          /*!< Test description */
    struct test_result_t ret;  /*!< Test result */
};

This structure declares "ret" parameter as a non const value. That parameters is the one which will store the test result at the end of the test execution.

Hence, the "static struct test_t" variable cannot be const and the current declaration is correct in the test suites.

This ticket can be closed as invalid, because source code was misinterpreted.

mmorenobarm closed this task as Invalid.Nov 15 2018, 11:49 AM