Skip to content

Commit

Permalink
Merge branch 'master' into sem_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
linlingao authored Aug 27, 2018
2 parents 587390b + 0ebe814 commit f6bd275
Show file tree
Hide file tree
Showing 1,039 changed files with 31,843 additions and 14,931 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-->
[ ] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Target update
[ ] Functionality change
[ ] Breaking change

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ matrix:
- fusermount --version
before_script:
# Setup and patch littlefs-fuse
- git clone https://github.com/geky/littlefs-fuse littlefs_fuse
- git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
- git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
- echo '*' > littlefs_fuse/.mbedignore
- rm -rf littlefs_fuse/littlefs/*
Expand Down Expand Up @@ -238,7 +238,7 @@ matrix:
- make clean size
CC='arm-none-eabi-gcc -mthumb'
OBJ="$(ls lfs*.o | tr '\n' ' ')"
CFLAGS+="-DLFS_NO{ASSERT,DEBUG,WARN,ERROR}"
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
| tee sizes
after_success:
# update status if we succeeded, compare with master if possible
Expand Down
33 changes: 2 additions & 31 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,2 @@

// List of targets to compile
def targets = [
//"LPC1768",
//"NUCLEO_F401RE",
//"NRF51822",
"K64F"
]

// Map toolchains to compiler labels on Jenkins
def toolchains = [
ARM: "armcc",
//IAR: "iar_arm",
GCC_ARM: "arm-none-eabi-gcc"
]

// mbed.getCurrentBranch returns either local branch name or reference to pull request
def currentBranch = mbed.getCurrentBranch()

// Create a map of predefined build steps
def parallelSteps = mbed.createParalleSteps("mbed-os", targets, toolchains)

// Run build steps parallel, map as paramater
mbed.compile(parallelSteps)

def testApps = [
"mbed-os-cliapp"
]

// buildTestApps accepts array of test application names and a mbed-os branch or PR reference as parameters
mbed.buildTestApps(testApps, "${currentBranch}")
// This is internal file to run tests in internal Jenkins
mbed.run_job()
96 changes: 61 additions & 35 deletions TESTS/events/queue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "utest.h"

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#error [NOT_SUPPORTED] test not supported
#endif

using namespace utest::v1;
Expand All @@ -38,32 +38,38 @@ using namespace utest::v1;
volatile bool touched = false;

// static functions
void func5(int a0, int a1, int a2, int a3, int a4) {
void func5(int a0, int a1, int a2, int a3, int a4)
{
touched = true;
TEST_ASSERT_EQUAL(a0 | a1 | a2 | a3 | a4, 0x1f);
}

void func4(int a0, int a1, int a2, int a3) {
void func4(int a0, int a1, int a2, int a3)
{
touched = true;
TEST_ASSERT_EQUAL(a0 | a1 | a2 | a3, 0xf);
TEST_ASSERT_EQUAL(a0 | a1 | a2 | a3, 0xf);
}

void func3(int a0, int a1, int a2) {
void func3(int a0, int a1, int a2)
{
touched = true;
TEST_ASSERT_EQUAL(a0 | a1 | a2, 0x7);
}

void func2(int a0, int a1) {
void func2(int a0, int a1)
{
touched = true;
TEST_ASSERT_EQUAL(a0 | a1, 0x3);
}

void func1(int a0) {
void func1(int a0)
{
touched = true;
TEST_ASSERT_EQUAL(a0, 0x1);
}

void func0() {
void func0()
{
touched = true;
}

Expand Down Expand Up @@ -95,40 +101,44 @@ SIMPLE_POSTS_TEST(1, 0x01)
SIMPLE_POSTS_TEST(0)


void time_func(Timer *t, int ms) {
void time_func(Timer *t, int ms)
{
TEST_ASSERT_INT_WITHIN(DELTA(ms), ms, t->read_ms());
t->reset();
}

template <int N>
void call_in_test() {
void call_in_test()
{
Timer tickers[N];

EventQueue queue(TEST_EQUEUE_SIZE);

for (int i = 0; i < N; i++) {
tickers[i].start();
queue.call_in((i+1)*100, time_func, &tickers[i], (i+1)*100);
queue.call_in((i + 1) * 100, time_func, &tickers[i], (i + 1) * 100);
}

queue.dispatch(N*100);
queue.dispatch(N * 100);
}

template <int N>
void call_every_test() {
void call_every_test()
{
Timer tickers[N];

EventQueue queue(TEST_EQUEUE_SIZE);

for (int i = 0; i < N; i++) {
tickers[i].start();
queue.call_every((i+1)*100, time_func, &tickers[i], (i+1)*100);
queue.call_every((i + 1) * 100, time_func, &tickers[i], (i + 1) * 100);
}

queue.dispatch(N*100);
queue.dispatch(N * 100);
}

void allocate_failure_test() {
void allocate_failure_test()
{
EventQueue queue(TEST_EQUEUE_SIZE);
int id;

Expand All @@ -139,12 +149,14 @@ void allocate_failure_test() {
TEST_ASSERT(!id);
}

void no() {
void no()
{
TEST_ASSERT(false);
}

template <int N>
void cancel_test1() {
void cancel_test1()
{
EventQueue queue(TEST_EQUEUE_SIZE);

int ids[N];
Expand All @@ -153,7 +165,7 @@ void cancel_test1() {
ids[i] = queue.call_in(1000, no);
}

for (int i = N-1; i >= 0; i--) {
for (int i = N - 1; i >= 0; i--) {
queue.cancel(ids[i]);
}

Expand All @@ -164,31 +176,38 @@ void cancel_test1() {
// Testing the dynamic arguments to the event class
unsigned counter = 0;

void count5(unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a5) {
void count5(unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a5)
{
counter += a0 + a1 + a2 + a3 + a5;
}

void count4(unsigned a0, unsigned a1, unsigned a2, unsigned a3) {
void count4(unsigned a0, unsigned a1, unsigned a2, unsigned a3)
{
counter += a0 + a1 + a2 + a3;
}

void count3(unsigned a0, unsigned a1, unsigned a2) {
void count3(unsigned a0, unsigned a1, unsigned a2)
{
counter += a0 + a1 + a2;
}

void count2(unsigned a0, unsigned a1) {
void count2(unsigned a0, unsigned a1)
{
counter += a0 + a1;
}

void count1(unsigned a0) {
void count1(unsigned a0)
{
counter += a0;
}

void count0() {
void count0()
{
counter += 0;
}

void event_class_test() {
void event_class_test()
{
counter = 0;
EventQueue queue(TEST_EQUEUE_SIZE);

Expand All @@ -211,7 +230,8 @@ void event_class_test() {
TEST_ASSERT_EQUAL(counter, 30);
}

void event_class_helper_test() {
void event_class_helper_test()
{
counter = 0;
EventQueue queue(TEST_EQUEUE_SIZE);

Expand All @@ -234,7 +254,8 @@ void event_class_helper_test() {
TEST_ASSERT_EQUAL(counter, 15);
}

void event_inference_test() {
void event_inference_test()
{
counter = 0;
EventQueue queue(TEST_EQUEUE_SIZE);

Expand All @@ -259,23 +280,26 @@ void event_inference_test() {

int timeleft_events[2];

void check_time_left(EventQueue* queue, int index, int expected) {
void check_time_left(EventQueue *queue, int index, int expected)
{
const int event_id = timeleft_events[index];
TEST_ASSERT_INT_WITHIN(2, expected, queue->time_left(event_id));
touched = true;
}

void time_left(EventQueue* queue, int index) {
void time_left(EventQueue *queue, int index)
{
const int event_id = timeleft_events[index];
TEST_ASSERT_EQUAL(0, queue->time_left(event_id));
}

void time_left_test() {
void time_left_test()
{
EventQueue queue(TEST_EQUEUE_SIZE);

// Enque check events
TEST_ASSERT(queue.call_in(50, check_time_left, &queue, 0, 100-50));
TEST_ASSERT(queue.call_in(200, check_time_left, &queue, 1, 200-200));
TEST_ASSERT(queue.call_in(50, check_time_left, &queue, 0, 100 - 50));
TEST_ASSERT(queue.call_in(200, check_time_left, &queue, 1, 200 - 200));

// Enque events to be checked
timeleft_events[0] = queue.call_in(100, time_left, &queue, 0);
Expand All @@ -299,7 +323,8 @@ void time_left_test() {
}

// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(20, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}
Expand Down Expand Up @@ -327,7 +352,8 @@ const Case cases[] = {

Specification specification(test_setup, cases);

int main() {
int main()
{
return !Harness::run(specification);
}

Loading

0 comments on commit f6bd275

Please sign in to comment.