[WIP] Add syntax check for rust and C\C++ code (#108)

* proof of concept

* fix syntax for rust and add auto fix syntax

* fix syntax for C

* fix bug with files owner

* add information to wiki

* try to add ci

* format code from master

* even more format fixes

* change docker to docker-compose

* Exclude ./target_*/build directories from format check

* Run rustfmt only on project files

* add ulimit setup for long clang list

* merge

* fix rustfmt, exclude target Inc directory

* sync with master

* abspath

Co-authored-by: aanper <mail@s3f.ru>
Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
Nikita Beletskii
2020-09-30 02:18:30 +03:00
committed by GitHub
parent 7ded31c19d
commit 110a9efc3c
73 changed files with 4354 additions and 4667 deletions

View File

@@ -29,10 +29,9 @@ bool test_furi_pipe_record(FuriRecordSubscriber* log) {
return false;
}
// 2. Open/subscribe to it
FuriRecordSubscriber* pipe_record = furi_open(
"test/pipe", false, false, pipe_record_cb, NULL, NULL
);
// 2. Open/subscribe to it
FuriRecordSubscriber* pipe_record =
furi_open("test/pipe", false, false, pipe_record_cb, NULL, NULL);
if(pipe_record == NULL) {
fuprintf(log, "cannot open record\n");
return false;
@@ -97,9 +96,8 @@ bool test_furi_holding_data(FuriRecordSubscriber* log) {
}
// 2. Open/Subscribe on it
FuriRecordSubscriber* holding_record = furi_open(
"test/holding", false, false, holding_record_cb, NULL, NULL
);
FuriRecordSubscriber* holding_record =
furi_open("test/holding", false, false, holding_record_cb, NULL, NULL);
if(holding_record == NULL) {
fuprintf(log, "cannot open record\n");
return false;
@@ -163,9 +161,8 @@ typedef struct {
void furi_concurent_app(void* p) {
FuriRecordSubscriber* log = (FuriRecordSubscriber*)p;
FuriRecordSubscriber* holding_record = furi_open(
"test/concurrent", false, false, NULL, NULL, NULL
);
FuriRecordSubscriber* holding_record =
furi_open("test/concurrent", false, false, NULL, NULL, NULL);
if(holding_record == NULL) {
fuprintf(log, "cannot open record\n");
furiac_exit(NULL);
@@ -202,18 +199,15 @@ bool test_furi_concurrent_access(FuriRecordSubscriber* log) {
}
// 2. Open it
FuriRecordSubscriber* holding_record = furi_open(
"test/concurrent", false, false, NULL, NULL, NULL
);
FuriRecordSubscriber* holding_record =
furi_open("test/concurrent", false, false, NULL, NULL, NULL);
if(holding_record == NULL) {
fuprintf(log, "cannot open record\n");
return false;
}
// 3. Create second app for interact with it
FuriApp* second_app = furiac_start(
furi_concurent_app, "furi concurent app", (void*)log
);
FuriApp* second_app = furiac_start(furi_concurent_app, "furi concurent app", (void*)log);
// 4. multiply ConcurrentValue::a
for(size_t i = 0; i < 4; i++) {
@@ -259,7 +253,6 @@ TEST: non-existent data
TODO: implement this test
*/
bool test_furi_nonexistent_data(FuriRecordSubscriber* log) {
return true;
}
@@ -326,9 +319,8 @@ void furi_mute_parent_app(void* p) {
}
// 2. Open watch handler: solo=false, no_mute=false, subscribe to data
FuriRecordSubscriber* watch_handler = furi_open(
"test/mute", false, false, mute_record_cb, NULL, NULL
);
FuriRecordSubscriber* watch_handler =
furi_open("test/mute", false, false, mute_record_cb, NULL, NULL);
if(watch_handler == NULL) {
fuprintf(log, "cannot open watch handler\n");
furiac_exit(NULL);
@@ -342,16 +334,13 @@ void furi_mute_parent_app(void* p) {
bool test_furi_mute_algorithm(FuriRecordSubscriber* log) {
// 1. Create "parent" application:
FuriApp* parent_app = furiac_start(
furi_mute_parent_app, "parent app", (void*)log
);
FuriApp* parent_app = furiac_start(furi_mute_parent_app, "parent app", (void*)log);
delay(2); // wait creating record
// 2. Open handler A: solo=false, no_mute=false, NULL subscriber. Subscribe to state.
FuriRecordSubscriber* handler_a = furi_open(
"test/mute", false, false, NULL, mute_record_state_cb, NULL
);
FuriRecordSubscriber* handler_a =
furi_open("test/mute", false, false, NULL, mute_record_state_cb, NULL);
if(handler_a == NULL) {
fuprintf(log, "cannot open handler A\n");
return false;
@@ -371,9 +360,7 @@ bool test_furi_mute_algorithm(FuriRecordSubscriber* log) {
}
// 3. Open handler B: solo=true, no_mute=true, NULL subscriber.
FuriRecordSubscriber* handler_b = furi_open(
"test/mute", true, true, NULL, NULL, NULL
);
FuriRecordSubscriber* handler_b = furi_open("test/mute", true, true, NULL, NULL, NULL);
if(handler_b == NULL) {
fuprintf(log, "cannot open handler B\n");
return false;
@@ -400,7 +387,6 @@ bool test_furi_mute_algorithm(FuriRecordSubscriber* log) {
test_counter = 3;
// Try to write data to B and check that subscriber get data.
if(!furi_write(handler_b, &test_counter, sizeof(uint8_t))) {
fuprintf(log, "write to B failed\n");
@@ -412,11 +398,8 @@ bool test_furi_mute_algorithm(FuriRecordSubscriber* log) {
return false;
}
// 4. Open hadler C: solo=true, no_mute=false, NULL subscriber.
FuriRecordSubscriber* handler_c = furi_open(
"test/mute", true, false, NULL, NULL, NULL
);
FuriRecordSubscriber* handler_c = furi_open("test/mute", true, false, NULL, NULL, NULL);
if(handler_c == NULL) {
fuprintf(log, "cannot open handler C\n");
return false;
@@ -427,9 +410,7 @@ bool test_furi_mute_algorithm(FuriRecordSubscriber* log) {
// TODO: Try to write data to C and check that subscriber get data.
// 5. Open handler D: solo=false, no_mute=false, NULL subscriber.
FuriRecordSubscriber* handler_d = furi_open(
"test/mute", false, false, NULL, NULL, NULL
);
FuriRecordSubscriber* handler_d = furi_open("test/mute", false, false, NULL, NULL, NULL);
if(handler_d == NULL) {
fuprintf(log, "cannot open handler D\n");
return false;

View File

@@ -78,7 +78,7 @@ typedef struct {
void task_a(void*);
void task_b(void*);
void task_a(void *p) {
void task_a(void* p) {
// simply starts, add 'A' letter to sequence and switch
// if sequence counter = 0, call task B, exit otherwise
@@ -118,7 +118,7 @@ bool test_furi_ac_switch_exit(FuriRecordSubscriber* log) {
furiac_start(task_a, "task A", (void*)&seq);
// TODO how to check that all child task ends?
delay(10); // wait while task do its work
seq.sequence[seq.count] = '\0';

View File

@@ -15,7 +15,7 @@ bool test_furi_mute_algorithm(FuriRecordSubscriber* log);
void flipper_test_app(void* p) {
FuriRecordSubscriber* log = get_default_log();
if(test_furi_ac_create_kill(log)) {
fuprintf(log, "[TEST] test_furi_ac_create_kill PASSED\n");
} else {
@@ -66,6 +66,5 @@ void flipper_test_app(void* p) {
rust_uart_write();
furiac_exit(NULL);
}