style: fix clang-format violations in test files
CI / lint (push) Failing after 8s
CI / build-and-test (push) Has been skipped
CI / sanitizers (address) (push) Has been skipped
CI / coverage (push) Has been skipped
CI / valgrind (push) Has been skipped
CI / lint (pull_request) Failing after 7s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
CI / lint (push) Failing after 8s
CI / build-and-test (push) Has been skipped
CI / sanitizers (address) (push) Has been skipped
CI / coverage (push) Has been skipped
CI / valgrind (push) Has been skipped
CI / lint (pull_request) Failing after 7s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
Fix line wrapping and designated initializer alignment in test_file.c, test_protocol.c, and test_stress.c to pass CI clang-format check.
This commit is contained in:
+2
-2
@@ -153,8 +153,8 @@ static void test_file_send_receive() {
|
|||||||
memcpy(file->data->data, content, len);
|
memcpy(file->data->data, content, len);
|
||||||
file->data->size = len;
|
file->data->size = len;
|
||||||
|
|
||||||
Config* cfg = config_create(str_dup(PROTOCOL_VERSION), str_dup("/tmp"), str_dup("/tmp"),
|
Config* cfg = config_create(str_dup(PROTOCOL_VERSION), str_dup("/tmp"), str_dup("/tmp"), false,
|
||||||
false, false, false, false, false, 0, false, 0);
|
false, false, false, false, 0, false, 0);
|
||||||
|
|
||||||
int p[2];
|
int p[2];
|
||||||
EXPECT_EQ_INT(pipe(p), 0);
|
EXPECT_EQ_INT(pipe(p), 0);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ static void test_send_receive_status() {
|
|||||||
io_set_fds(p[0], p[1]);
|
io_set_fds(p[0], p[1]);
|
||||||
io_set_bwlimit(0);
|
io_set_bwlimit(0);
|
||||||
|
|
||||||
Status statuses[] = {STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT,
|
Status statuses[] = {STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT,
|
||||||
STATUS_CHUNK, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA};
|
STATUS_CHUNK, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA};
|
||||||
int count = sizeof(statuses) / sizeof(statuses[0]);
|
int count = sizeof(statuses) / sizeof(statuses[0]);
|
||||||
|
|
||||||
|
|||||||
+15
-18
@@ -51,7 +51,7 @@ static int mpmc_consumer_func(void* arg) {
|
|||||||
ConsumerMPMC* ctx = (ConsumerMPMC*)arg;
|
ConsumerMPMC* ctx = (ConsumerMPMC*)arg;
|
||||||
while (true) {
|
while (true) {
|
||||||
int* val = (int*)queue_dequeue_multithreaded(ctx->q, ctx->mutex, ctx->cnd_empty, ctx->cnd_full,
|
int* val = (int*)queue_dequeue_multithreaded(ctx->q, ctx->mutex, ctx->cnd_empty, ctx->cnd_full,
|
||||||
(const bool*)ctx->producers_done);
|
(const bool*)ctx->producers_done);
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
break;
|
break;
|
||||||
free(val);
|
free(val);
|
||||||
@@ -73,11 +73,11 @@ static void test_queue_mpmc_stress() {
|
|||||||
volatile bool producers_done = false;
|
volatile bool producers_done = false;
|
||||||
|
|
||||||
ConsumerMPMC cctx = {.q = q,
|
ConsumerMPMC cctx = {.q = q,
|
||||||
.mutex = &mutex,
|
.mutex = &mutex,
|
||||||
.cnd_empty = &cnd_empty,
|
.cnd_empty = &cnd_empty,
|
||||||
.cnd_full = &cnd_full,
|
.cnd_full = &cnd_full,
|
||||||
.producers_remaining = &producers_remaining,
|
.producers_remaining = &producers_remaining,
|
||||||
.producers_done = &producers_done};
|
.producers_done = &producers_done};
|
||||||
|
|
||||||
thrd_t consumers[NUM_CONSUMERS];
|
thrd_t consumers[NUM_CONSUMERS];
|
||||||
for (int i = 0; i < NUM_CONSUMERS; i++) {
|
for (int i = 0; i < NUM_CONSUMERS; i++) {
|
||||||
@@ -88,11 +88,8 @@ static void test_queue_mpmc_stress() {
|
|||||||
ProducerCtx pctxs[NUM_PRODUCERS];
|
ProducerCtx pctxs[NUM_PRODUCERS];
|
||||||
thrd_t producers[NUM_PRODUCERS];
|
thrd_t producers[NUM_PRODUCERS];
|
||||||
for (int i = 0; i < NUM_PRODUCERS; i++) {
|
for (int i = 0; i < NUM_PRODUCERS; i++) {
|
||||||
pctxs[i] = (ProducerCtx){.q = q,
|
pctxs[i] = (ProducerCtx){
|
||||||
.mutex = &mutex,
|
.q = q, .mutex = &mutex, .cnd_empty = &cnd_empty, .cnd_full = &cnd_full, .producer_id = i};
|
||||||
.cnd_empty = &cnd_empty,
|
|
||||||
.cnd_full = &cnd_full,
|
|
||||||
.producer_id = i};
|
|
||||||
int res = thrd_create(&producers[i], mpmc_producer_func, &pctxs[i]);
|
int res = thrd_create(&producers[i], mpmc_producer_func, &pctxs[i]);
|
||||||
EXPECT_EQ_INT(res, thrd_success);
|
EXPECT_EQ_INT(res, thrd_success);
|
||||||
}
|
}
|
||||||
@@ -144,7 +141,7 @@ static int bp_consumer_func(void* arg) {
|
|||||||
BackpressureCtx* ctx = (BackpressureCtx*)arg;
|
BackpressureCtx* ctx = (BackpressureCtx*)arg;
|
||||||
while (ctx->items_received < 5) {
|
while (ctx->items_received < 5) {
|
||||||
int* val = (int*)queue_dequeue_multithreaded(ctx->q, ctx->mutex, ctx->cnd_empty, ctx->cnd_full,
|
int* val = (int*)queue_dequeue_multithreaded(ctx->q, ctx->mutex, ctx->cnd_empty, ctx->cnd_full,
|
||||||
&ctx->done);
|
&ctx->done);
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
break;
|
break;
|
||||||
ctx->items_received++;
|
ctx->items_received++;
|
||||||
@@ -164,12 +161,12 @@ static void test_queue_backpressure() {
|
|||||||
cnd_init(&cnd_full);
|
cnd_init(&cnd_full);
|
||||||
|
|
||||||
BackpressureCtx ctx = {.q = q,
|
BackpressureCtx ctx = {.q = q,
|
||||||
.mutex = &mutex,
|
.mutex = &mutex,
|
||||||
.cnd_empty = &cnd_empty,
|
.cnd_empty = &cnd_empty,
|
||||||
.cnd_full = &cnd_full,
|
.cnd_full = &cnd_full,
|
||||||
.items_sent = 0,
|
.items_sent = 0,
|
||||||
.items_received = 0,
|
.items_received = 0,
|
||||||
.done = false};
|
.done = false};
|
||||||
|
|
||||||
thrd_t producer, consumer;
|
thrd_t producer, consumer;
|
||||||
int res;
|
int res;
|
||||||
|
|||||||
Reference in New Issue
Block a user