Commit ef61bd59 authored by Daniel Silveira's avatar Daniel Silveira

Hello world and HM Test now end.

Others example need to be reviewed and consider remove them.

Removed TEST-DEF-00770

Refs #39
parent 8cc99271
......@@ -33,6 +33,7 @@ stages:
- sbuild-sparc
- sclean-build-sparc
- test_hello_world_sparc
- test_hm_sparc
- test_00009_sparc
- test_00010_sparc
- test_00012_sparc
......@@ -65,7 +66,7 @@ build_sparc:
stage: sbuild-sparc
script:
- make clean # to be removed and used only on failure
- make
- make -j3
#clean_build_sparc:
# tags:
......@@ -92,7 +93,7 @@ build_arm:
stage: sbuild-arm
script:
- make clean # to be removed and used only on failure
- make
- make -j3
#clean_build_arm:
# tags:
......@@ -105,7 +106,7 @@ build_arm:
########################
#Tests for SPARC #
#Example Tests for SPARC #
########################
hello_sparc:
# tags:
......@@ -119,6 +120,21 @@ hello_sparc:
environment:
name: SPARC LEON4
hello_sparc:
# tags:
# - sparc
stage: test_hm_sparc
script:
- cd $AIR/examples/hm
- cp $AIR/../utils/gitlab-runner/* .
- ./do_leon4_grmon.bash
- cd $AIR
environment:
name: SPARC LEON4
########################
#Unit Tests for SPARC #
########################
00009_sparc:
# tags:
......
......@@ -157,7 +157,7 @@
<Sampling_Port Direction="SOURCE" MaxMessageSize="32" Name="SEND_SAMP1" RefreshRateSeconds="1.000"/>
<Sampling_Port Direction="DESTINATION" MaxMessageSize="32" Name="RECV_SAMP1" RefreshRateSeconds="1.000"/>
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR;IMASPEX</Libs>
<Libs>LIBAIR;IMASPEX; LIBPRINTF;</Libs>
<Cache>CODE; DATA</Cache>
<Memory Size="0x500000" />
<Permissions>
......@@ -171,11 +171,11 @@
<Sampling_Port Direction="SOURCE" MaxMessageSize="32" Name="SEND_SAMP2" RefreshRateSeconds="1.000"/>
<Sampling_Port Direction="DESTINATION" MaxMessageSize="32" Name="RECV_SAMP2" RefreshRateSeconds="1.000"/>
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR; IMASPEX</Libs>
<Libs>LIBAIR; IMASPEX; LIBPRINTF</Libs>
<Cache>CODE; DATA</Cache>
<Memory Size="0x500000" />
<Permissions>
FPU_CONTROL; GLOBAL_TIME; SET_TOD; SET_PARTITION_MODE;
FPU_CONTROL; GLOBAL_TIME; SET_TOD; SET_PARTITION_MODE; MODULE_CONTROL;
</Permissions>
</PartitionConfiguration>
</Partition>
......@@ -219,7 +219,7 @@
<Error_ID_Action Action="IGNORE" Description="Unimplemented Error" ErrorIdentifier="3"/>
<Error_ID_Action Action="IGNORE" Description="Floating Point Error" ErrorIdentifier="4"/>
<Error_ID_Action Action="COLD_START" Description="Overflow Error" ErrorIdentifier="5"/>
<Error_ID_Action Action="WARM_START" Description="Divide by zero" ErrorIdentifier="6"/>
<Error_ID_Action Action="IGNORE" Description="Divide by zero" ErrorIdentifier="6"/>
<Error_ID_Action Action="COLD_START" Description="I/O Error" ErrorIdentifier="7"/>
<Error_ID_Action Action="IDLE" Description="Partition Conf Error" ErrorIdentifier="8"/>
<Error_ID_Action Action="IDLE" Description="Partition Init Error" ErrorIdentifier="9"/>
......@@ -265,7 +265,7 @@
<Error_ID_Action Action="IGNORE" Description="Unimplemented Error" ErrorIdentifier="3"/>
<Error_ID_Action Action="IGNORE" Description="Floating Point Error" ErrorIdentifier="4"/>
<Error_ID_Action Action="COLD_START" Description="Overflow Error" ErrorIdentifier="5"/>
<Error_ID_Action Action="WARM_START" Description="Divide by zero" ErrorIdentifier="6"/>
<Error_ID_Action Action="IGNORE" Description="Divide by zero" ErrorIdentifier="6"/>
<Error_ID_Action Action="COLD_START" Description="I/O Error" ErrorIdentifier="7"/>
<Error_ID_Action Action="IDLE" Description="Partition Conf Error" ErrorIdentifier="8"/>
<Error_ID_Action Action="IDLE" Description="Partition Init Error" ErrorIdentifier="9"/>
......
......@@ -8,11 +8,7 @@
#include <air.h>
#include <rtems.h>
#ifdef RTEMS48I
#include <pprintf.h>
#else
#include <stdio.h>
#endif
#include <pprintf.h>
int producer() {
......@@ -43,19 +39,11 @@ int producer() {
uint32_t tps = 1000000 / air_syscall_get_us_per_tick();
for (;;)
for (int i=0; i<3; i++)
{
#ifdef RTEMS48I
pprintf("In partition PO loop\n");
#else
printf("In partition PO loop\n");
#endif
rtems_task_wake_after(tps/2);
#ifdef RTEMS48I
pprintf("P0 : Waking up %d\n", x);
#else
printf("P0 : Waking up %d\n", x);
#endif
}
return AIR_SUCCESSFUL;
......
......@@ -8,11 +8,7 @@
#include <air.h>
#include <rtems.h>
#ifdef RTEMS48I
#include <pprintf.h>
#else
#include <stdio.h>
#endif
#include <pprintf.h>
void partition_HM_callback(air_state_e state_id,air_error_e error_id)
{
......@@ -31,20 +27,13 @@ int receiver() {
uint32_t tps = 1000000 / air_syscall_get_us_per_tick();
for (;;)
for (int i=0; i<3; i++)
{
#ifdef RTEMS48I
pprintf("In partition P1 loop\n");
#else
printf("In partition P1 loop\n");
#endif
rtems_task_wake_after(tps/2);
#ifdef RTEMS48I
pprintf("P1 : Waking up - %d\n", x);
#else
printf("P1 : Waking up - %d\n", x);
#endif
}
air_syscall_shutdown_module();
return AIR_SUCCESSFUL;
}
......@@ -100,7 +100,7 @@ int test_main (void) {
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
} else {
} else {
res &= test_report(__FILE__, __LINE__, TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE,
ret);
......
/* ============================================================================
* Copyright (C) GMVIS Skysoft S.A., 2013
* ============================================================================
* This file is part of the AIR - ARINC 653 Interface in RTEMS - Operating
* system testsuite, which is distributed under the terms of the AIR License
* Agreement.
* The full extent of the AIR License Agreement is described in the contract
* celebrated between GMVIS Skysoft and the Client.
* ==========================================================================*/
/*
* TEST-DEF-00770
*
* Requirements:
*
* Test Description:
* Define a test configuration with the following actions for the given
* states: State: Partition Application, Error: Segmentation Error,
* ErrorLevel: Partition State: Health Monitor Processing, Error:
* Segmentation Error, ErrorLevel: Module The test application shall generate
* a segmentation fault. The partition callback called by the Health Monitor
* shall in turn also generate a segmentation fault. Check that this
* translates into a system level HM event that is properly detected and
* handled.
*/
#include <rtems.h>
#include <air.h>
#include <air_test.h>
#include <P0testdef.h>
/* Test external definitions */
/* Test type definitions */
/* Test global variables */
int unexp_error = 0;
int mod_callback_control = 0;
int mtf_ticks = 30;
int *get_mod_callback_control (void) {
return &(mod_callback_control);
}
/**
* @brief Test HM callbacks
*/
void hm_part_callback(pmk_hm_err_id_e i_error,void *i_state){
/* i_state is not really a pointer, this signature is required due to the
pal_callbacks function signature -> convert it into a relevant value */
/* signal error occurrence */
if (i_error == PMK_SEG_ERR) {
unexp_error++;
void *ptr = NULL;
memcpy(ptr, &i_error, 1);
}
}
/**
* @brief Test execution
*/
int test_main(void){
/* repetition iteration counter */
int repeat = 0;
/* function to test return code */
rtems_status_code ret = RTEMS_SUCCESSFUL;
/* total test result */
int res = TEST_SUCCESS;
/* Test specific variables */
/* Test Start */
test_enter(770);
/*
* Test Step 0:
* Generate an PMK_SEG_ERR on the application (try to write to
* 0x00000000)
*/
test_step_announce(0, 1);
void *ptr = NULL;
/* random source value */
uint8_t value = 7;
/* write to 0x00000000 */
memcpy(ptr, (void *) &value, 1);
/* Test Step 0 code */
ret |= RTEMS_SUCCESSFUL;
/* Check if the result is expected */
if ((RTEMS_SUCCESSFUL == ret) && (ptr == NULL)) {
res &= test_step_report(TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE, ret);
} else {
res &= test_step_report(TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE, ret);
}
/*
* Test Step 1:
* Check that the partition health monitor callback has been called
*/
test_step_announce(1, 1);
/* Test Step 1 code */
ret |= RTEMS_SUCCESSFUL;
/* Check if the result is expected */
if ((RTEMS_SUCCESSFUL == ret) && (1 == unexp_error)) {
res &= test_step_report(TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE, ret);
} else {
res &= test_step_report(TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE, ret);
}
/*
* Test Step 2:
* Generate an PMK_SEG_ERR on the health monitor callback
*/
test_step_announce(2, 1);
/* Test Step 2 code */
ret |= RTEMS_SUCCESSFUL;
/* Check if the result is expected */
if ((RTEMS_SUCCESSFUL == ret)
&& (NULL != mod_callback_control) ) {
res &= test_step_report(TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE, ret);
} else {
res &= test_step_report(TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE, ret);
}
/*
* Test Step 3:
* Check that the module health monitor callback has been called.
*/
test_step_announce(3, 1);
/* Test Step 3 code */
ret |= RTEMS_SUCCESSFUL;
/* Check if the result is expected */
if ((RTEMS_SUCCESSFUL == ret) && (0 < mod_callback_control)) {
res &= test_step_report(TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE, ret);
} else {
res &= test_step_report(TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE, ret);
}
/*
* Test Step 4:
* Terminate test.
*/
test_step_announce(4, 1);
/* Test Step 4 code */
ret |= RTEMS_SUCCESSFUL;
/* Check if the result is expected */
if ((RTEMS_SUCCESSFUL == ret) && (1 == mod_callback_control) &&
(1 == unexp_error)) {
res &= test_step_report(TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE, ret);
} else {
res &= test_step_report(TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE, ret);
}
/* Test End */
test_exit(res, mtf_ticks);
return 0;
}
/* ============================================================================
* Copyright (C) GMVIS Skysoft S.A., 2013
* ============================================================================
* This file is part of the AIR - ARINC 653 Interface in RTEMS - Operating
* system testsuite, which is distributed under the terms of the AIR License
* Agreement.
* The full extent of the AIR License Agreement is described in the contract
* celebrated between GMVIS Skysoft and the Client.
* ==========================================================================*/
/*
* TEST-DEF-00770
*
* Requirements:
*
* Test Description:
* Define a test configuration with the following actions for the given
* states: State: Partition Application, Error: Segmentation Error,
* ErrorLevel: Partition State: Health Monitor Processing, Error:
* Segmentation Error, ErrorLevel: Module The test application shall generate
* a segmentation fault. The partition callback called by the Health Monitor
* shall in turn also generate a segmentation fault. Check that this
* translates into a system level HM event that is properly detected and
* handled.
*/
#ifndef _TEST_GMV_770_
#define _TEST_GMV_770_
/* Unique Test Identifier */
#define TEST_ID (770)
/* Number of times the test procedure should be repeated */
#define TEST_REPEAT (1)
/* Unique test steps (not counting step repetitions) */
#define TEST_STEPS (5)
/* Total number of tests steps executions */
#define TEST_ITERATIONS (5)
/* Test Steps IDs and Repeats */
const char* const test_step_id_list[TEST_STEPS] = { \
"000",
"001",
"002",
"003",
"004",
};
const int const test_step_rep_list[TEST_STEPS] = {
1,
1,
1,
1,
1,
};
#endif /* _TEST_GMV_770_ */
/* *********************************************************************** */
/* ** TEST-DEF-00009 / 9 ************************************************ */
/* *********************************************************************** */
#include <rtems.h>
#include <air.h>
#include <air_test.h>
/* Test Printf ******************************************************* */
int test_printf (void) {
while(1) {
control_partition_init(1, TEST_MEMSHARE);
/* TODO : this value is somewhat random */
rtems_task_wake_after(25);
}
return 0;
}
\ No newline at end of file
......@@ -9,10 +9,7 @@
/* *********************************************************************** */
/* Test Description ****************************************************** */
/* Define a test where the MMU tables (L1, L2, L3) are overwritten by a
non-supervisor partition. Check that this attempt is unsuccessful, and the event is
captured and handled by the HM, and the associated HM action is called. Test if the
remaining partitions continue to execute. */
/* Define a test where the MMU region is overwritten by a non-supervisor partition. Check that this attempt is unsuccessful, and the event is captured and handled by the HM, and the associated HM action is called. Test if the remaining partitions continue to execute. */
#include <rtems.h>
......@@ -83,7 +80,7 @@ int test_main (void) {
/* Test Step 5
Execute a regular operation (e.g. increment a variable). */
test_step_announce(5,1);
test_step_announce(2,1);
i++;
......@@ -100,7 +97,7 @@ int test_main (void) {
/* Test Step 6
Terminate test. */
test_step_announce(6,1);
test_step_announce(3,1);
/* EXPECTED: */
if (0 == unexp_error) {
......
......@@ -9,46 +9,23 @@
/* *********************************************************************** */
/* Test Description ****************************************************** */
/* Define a test where the MMU tables (L1, L2, L3) are overwritten by a
non-supervisor partition. Check that this attempt is unsuccessful, and the event is
captured and handled by the HM, and the associated HM action is called. Test if the
remaining partitions continue to execute. */
/* Define a test where the MMU region is overwritten by a non-supervisor partition. Check that this attempt is unsuccessful, and the event is captured and handled by the HM, and the associated HM action is called. Test if the remaining partitions continue to execute. */
#include <rtems.h>
#include <air.h>
#include <air_test.h>
#include <P1testdef.h>
#include <segregation.h>
/* Test external definitions ********************************************** */
#include <pmk_segregation.h>
#include <pmk_linkcmd_vars.h>
/* Test type definitions ************************************************** */
/* Test global variables ************************************************** */
int unexp_error = 0;
int mtf_ticks = 30;
/* Context Table */
PMK_MMU_ContextTable_t *ContextTable =
(PMK_MMU_ContextTable_t *)&air_memmap_MMU_ContextTableStart;
/** Pointer to System Level 1 table which contains L1 tables for all partitions*/
static PMK_MMU_L1Table_t *L1Table =
(PMK_MMU_L1Table_t *)&air_memmap_MMU_Level1TableStart;
/** Pointer to System Level 2 table which contains L2 tables for all partitions*/
static PMK_MMU_Partition_L2Tables_t *L2Table =
(PMK_MMU_Partition_L2Tables_t *)&air_memmap_MMU_Level2TablesStart;
/** Pointer to System Level 3 table which contains L3 tables for all partitions*/
static PMK_MMU_Partition_L3Tables_t *L3Table =
(PMK_MMU_Partition_L3Tables_t *) &air_memmap_MMU_Level3TablesStart;
/* Test auxiliary functions ******************************************** */
extern air_u32_t air_workspace;
/* Test HM callbacks *********************************************** */
void partition_HM_callback(air_state_e state_id,air_error_e i_error) {
......@@ -72,60 +49,23 @@ int test_main (void) {
/* Test specific variables ****************************************** */
int part_point = 1;
air_u32_t * current_pointer;
/* Test Start ****************************************************** */
test_enter(790);
/* Test Steps ******************************************************* */
/* Test Step 1
Attempt to write the Context MMU Table. Verify that a trap was
Attempt to write in the MMU region. Verify that a trap was
raised. */
test_step_announce(1,1);
/* delete one random context entry */
(*ContextTable)[part_point] = 0x0;
/* EXPECTED: */
if (PMK_SEG_ERR == unexp_error) {
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
unexp_error = 0;
} else {
res &= test_report(__FILE__, __LINE__, TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE,
unexp_error);
test_exit(TEST_FAILURE,mtf_ticks>>1);
}
/* Test Step 2
Attempt to write a Level1 MMU Table entry. Verify that a trap was
raised. */
test_step_announce(2,1);
/* change one random entry entry */
(L1Table)[0][10] = 0xDEAD;
/* EXPECTED: */
if (PMK_SEG_ERR == unexp_error) {
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
unexp_error = 0;
} else {
res &= test_report(__FILE__, __LINE__, TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE,
unexp_error);
test_exit(TEST_FAILURE,mtf_ticks>>1);
}
/* Test Step 3
Attempt to write a Level2 MMU Table entry. Verify that a trap was
raised. */
test_step_announce(3,1);
/* Test step 3 code */
L2Table[1][5][10] = 0xDEAD;
/* Set zero random MMU entry */
current_pointer = &air_workspace + 100;
*current_pointer = 0xDEAD;
/* EXPECTED: */
if (PMK_SEG_ERR == unexp_error) {
if (AIR_SEGMENTATION_ERROR == unexp_error) {
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
......@@ -137,28 +77,6 @@ int test_main (void) {
test_exit(TEST_FAILURE,mtf_ticks>>1);
}
/* Test Step 4
Attempt to write a Level3 MMU Table entry. Verify that a trap was
raised. */
test_step_announce(4,1);
/* Test step 4 code */
L3Table[0][0][20] = 0xDEAD;
/* EXPECTED: */
if (PMK_SEG_ERR == unexp_error) {
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
unexp_error = 0;
} else {
res &= test_report(__FILE__, __LINE__, TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE,
unexp_error);
test_exit(TEST_FAILURE,mtf_ticks>>1);
}
/* Test End */
test_return(res);
return 0;
......
......@@ -74,11 +74,11 @@ int test_main (void) {
/* EXPECTED: */
if (((ccr & 0xF) == 0xF) && (0 == unexp_error)) {
res &= test_step_report( TEST_SUCCESS,
res &= test_report(__FILE__, __LINE__, TEST_SUCCESS,
RESULT_EQUAL | RESULT_TYPE_VALUE,
ret);
} else {
res &= test_step_report(TEST_FAILURE,
res &= test_report(__FILE__, __LINE__, TEST_FAILURE,
RESULT_DIFF | RESULT_TYPE_VALUE,
ret);
test_exit(TEST_FAILURE,mtf_ticks);
......