Add SPM code generation test to Travis-CI

pull/8889/head
Oren Cohen 2018-11-28 10:10:13 +02:00
parent 52822cb8af
commit 45bd4f305a
8 changed files with 98 additions and 92 deletions

View File

@ -280,3 +280,9 @@ matrix:
- echo 'Checking that there is no GPL licence text in code'
- ! git grep -q --ignore-case "gnu general public";
- ! git grep -q --ignore-case "gnu library general public";
- env:
- NAME=psa-autogen
script:
# Run SPM code generator and check that changes are not needed
- python tools/spm/generate_partition_code.py
- git diff --exit-code

View File

@ -26,8 +26,8 @@
#include "handles_manager.h"
#include "cmsis.h"
#include "psa_test_its_reset_partition.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t psa_f_external_sids[4];
@ -43,17 +43,6 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = TEST_ITS_RESET_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -65,6 +54,17 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -76,8 +76,8 @@ const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void test_its_reset_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
uint32_t init_partitions(spm_partition_t **partitions)
{
@ -86,8 +86,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
}
test_its_reset_init(&(g_partitions[0]));
its_init(&(g_partitions[1]));
psa_f_init(&(g_partitions[2]));
psa_f_init(&(g_partitions[1]));
its_init(&(g_partitions[2]));
*partitions = g_partitions;
return 3;

View File

@ -28,8 +28,8 @@
#include "handles_manager.h"
#include "cmsis.h"
#include "psa_test_its_reset_partition.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t psa_f_external_sids[4];
@ -45,17 +45,6 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = TEST_ITS_RESET_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -67,6 +56,17 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -78,8 +78,8 @@ const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void test_its_reset_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
uint32_t init_partitions(spm_partition_t **partitions)
{
@ -88,8 +88,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
}
test_its_reset_init(&(g_partitions[0]));
its_init(&(g_partitions[1]));
psa_f_init(&(g_partitions[2]));
psa_f_init(&(g_partitions[1]));
its_init(&(g_partitions[2]));
*partitions = g_partitions;
return 3;

View File

@ -28,8 +28,8 @@
#include "handles_manager.h"
#include "cmsis.h"
#include "psa_client_tests_part1_partition.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t psa_f_external_sids[4];
@ -45,17 +45,6 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = CLIENT_TESTS_PART1_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -67,6 +56,17 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -78,8 +78,8 @@ const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void client_tests_part1_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
uint32_t init_partitions(spm_partition_t **partitions)
{
@ -88,8 +88,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
}
client_tests_part1_init(&(g_partitions[0]));
its_init(&(g_partitions[1]));
psa_f_init(&(g_partitions[2]));
psa_f_init(&(g_partitions[1]));
its_init(&(g_partitions[2]));
*partitions = g_partitions;
return 3;

View File

@ -29,8 +29,8 @@
#include "cmsis.h"
#include "psa_server_test_part1_partition.h"
#include "psa_server_test_part2_partition.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t server_test_part1_external_sids[2];
extern const uint32_t psa_f_external_sids[4];
@ -58,17 +58,6 @@ spm_partition_t g_partitions[4] = {
.extern_sids_count = SERVER_TEST_PART2_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -80,6 +69,17 @@ spm_partition_t g_partitions[4] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -92,8 +92,8 @@ const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void server_test_part1_init(spm_partition_t *partition);
void server_test_part2_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
uint32_t init_partitions(spm_partition_t **partitions)
{
@ -103,8 +103,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
server_test_part1_init(&(g_partitions[0]));
server_test_part2_init(&(g_partitions[1]));
its_init(&(g_partitions[2]));
psa_f_init(&(g_partitions[3]));
psa_f_init(&(g_partitions[2]));
its_init(&(g_partitions[3]));
*partitions = g_partitions;
return 4;

View File

@ -28,8 +28,8 @@
#include "handles_manager.h"
#include "cmsis.h"
#include "psa_smoke_test_part1_partition.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t psa_f_external_sids[4];
@ -45,17 +45,6 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = SMOKE_TEST_PART1_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -67,6 +56,17 @@ spm_partition_t g_partitions[3] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -78,8 +78,8 @@ const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void smoke_test_part1_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
uint32_t init_partitions(spm_partition_t **partitions)
{
@ -88,8 +88,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
}
smoke_test_part1_init(&(g_partitions[0]));
its_init(&(g_partitions[1]));
psa_f_init(&(g_partitions[2]));
psa_f_init(&(g_partitions[1]));
its_init(&(g_partitions[2]));
*partitions = g_partitions;
return 3;

View File

@ -27,24 +27,13 @@
#include "spm_internal.h"
#include "handles_manager.h"
#include "cmsis.h"
#include "psa_its_partition.h"
#include "psa_psa_f_partition.h"
#include "psa_its_partition.h"
extern const uint32_t psa_f_external_sids[4];
__attribute__((weak))
spm_partition_t g_partitions[2] = {
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = PSA_F_ID,
.thread_id = 0,
@ -56,6 +45,17 @@ spm_partition_t g_partitions[2] = {
.extern_sids_count = PSA_F_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
{
.partition_id = ITS_ID,
.thread_id = 0,
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
.flags_interrupts = 0,
.rot_services = NULL,
.rot_services_count = ITS_ROT_SRV_COUNT,
.extern_sids = NULL,
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
.irq_mapper = NULL,
},
};
/* Check all the defined memory regions for overlapping. */
@ -68,8 +68,8 @@ __attribute__((weak))
const uint32_t mem_region_count = 0;
// forward declaration of partition initializers
void its_init(spm_partition_t *partition);
void psa_f_init(spm_partition_t *partition);
void its_init(spm_partition_t *partition);
__attribute__((weak))
uint32_t init_partitions(spm_partition_t **partitions)
@ -78,8 +78,8 @@ uint32_t init_partitions(spm_partition_t **partitions)
SPM_PANIC("partitions is NULL!\n");
}
its_init(&(g_partitions[0]));
psa_f_init(&(g_partitions[1]));
psa_f_init(&(g_partitions[0]));
its_init(&(g_partitions[1]));
*partitions = g_partitions;
return 2;

View File

@ -753,7 +753,7 @@ def generate_psa_code():
generate_partitions_sources(manifest_files)
test_manifest_files = sorted([path for path in manifest_files if 'TESTS' in path])
system_manifest_files = list(set(manifest_files) - set(test_manifest_files))
system_manifest_files = sorted(list(set(manifest_files) - set(test_manifest_files)))
# Generate default system psa setup file (only system partitions)
generate_psa_setup(system_manifest_files, SPM_CORE_ROOT, weak_setup=True)
@ -767,7 +767,7 @@ def generate_psa_code():
for test_root in spm_tests:
tests_dict[test_root] = filter(lambda manifest_path: test_root in manifest_path, test_manifest_files)
tests_dict[test_root] += system_manifest_files
generate_psa_setup(tests_dict[test_root], test_root, weak_setup=False)
generate_psa_setup(sorted(tests_dict[test_root]), test_root, weak_setup=False)
if __name__ == '__main__':