Commit 4c034667 authored by Tristan Gingold's avatar Tristan Gingold

ut: fix test_msg_time test.

parent cf73fa96
...@@ -175,7 +175,7 @@ static void test_in_trigger_software(CuTest *tc) ...@@ -175,7 +175,7 @@ static void test_in_trigger_software(CuTest *tc)
wrtd = wrtd_open(1); wrtd = wrtd_open(1);
CuAssertIntEquals(tc, 0, !wrtd); CuAssertIntEquals(tc, 0, !wrtd);
/* It does not metter which channel we query, the sent triggers /* It does not matter which channel we query, the sent triggers
value is global */ value is global */
CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd, 0, &st)); CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd, 0, &st));
sent = st.sent_packets; sent = st.sent_packets;
......
...@@ -340,7 +340,7 @@ static void test_msg_time(CuTest *tc) ...@@ -340,7 +340,7 @@ static void test_msg_time(CuTest *tc)
struct wrtd_trig_id tid_2 = {0, 2, 2}; struct wrtd_trig_id tid_2 = {0, 2, 2};
struct wrtd_trigger_handle h_1; struct wrtd_trigger_handle h_1;
struct wrtd_input_state sti1, sti2; struct wrtd_input_state sti1, sti2;
struct wrtd_output_state sto1, sto2; struct wrtd_output_state sto1;
const uint64_t tdelay = 200 * 1000 * 1000; const uint64_t tdelay = 200 * 1000 * 1000;
wrtd_0 = wrtd_open(1); wrtd_0 = wrtd_open(1);
...@@ -354,7 +354,7 @@ static void test_msg_time(CuTest *tc) ...@@ -354,7 +354,7 @@ static void test_msg_time(CuTest *tc)
/* Assign trigger input */ /* Assign trigger input */
CuAssertIntEquals(tc, 0, wrtd_in_trigger_assign(wrtd_1, 0, &tid_1)); CuAssertIntEquals(tc, 0, wrtd_in_trigger_assign(wrtd_1, 0, &tid_1));
CuAssertIntEquals(tc, 0, wrtd_in_trigger_assign(wrtd_1, 1, &tid_2)); CuAssertIntEquals(tc, 0, wrtd_in_trigger_assign(wrtd_1, 1, &tid_2));
CuAssertIntEquals(tc, 0, wrtd_in_trigger_mode_set(wrtd_1, 0, WRTD_TRIGGER_MODE_SINGLE)); CuAssertIntEquals(tc, 0, wrtd_in_trigger_mode_set(wrtd_1, 0, WRTD_TRIGGER_MODE_AUTO));
CuAssertIntEquals(tc, 0, wrtd_in_trigger_mode_set(wrtd_1, 1, WRTD_TRIGGER_MODE_AUTO)); CuAssertIntEquals(tc, 0, wrtd_in_trigger_mode_set(wrtd_1, 1, WRTD_TRIGGER_MODE_AUTO));
CuAssertIntEquals(tc, 0, wrtd_in_dead_time_set(wrtd_1, 0, 80 * 1000 * 1000)); CuAssertIntEquals(tc, 0, wrtd_in_dead_time_set(wrtd_1, 0, 80 * 1000 * 1000));
CuAssertIntEquals(tc, 0, wrtd_in_dead_time_set(wrtd_1, 1, 80 * 1000 * 1000)); CuAssertIntEquals(tc, 0, wrtd_in_dead_time_set(wrtd_1, 1, 80 * 1000 * 1000));
...@@ -382,11 +382,14 @@ static void test_msg_time(CuTest *tc) ...@@ -382,11 +382,14 @@ static void test_msg_time(CuTest *tc)
/* Stop getting pulses from pulse-generator */ /* Stop getting pulses from pulse-generator */
CuAssertIntEquals(tc, 0, wrtd_in_enable(wrtd_1, 0, 0)); CuAssertIntEquals(tc, 0, wrtd_in_enable(wrtd_1, 0, 0));
sleep(4); sleep(2);
CuAssertIntEquals(tc, 0, wrtd_in_enable(wrtd_1, 1, 0));
// CuAssertIntEquals(tc, 0, wrtd_out_enable(wrtd_0, 0, 0)); // Disable channel
// CuAssertIntEquals(tc, 0, wrtd_out_enable(wrtd_0, 1, 0)); CuAssertIntEquals(tc, 0, wrtd_in_enable(wrtd_1, 1, 0));
CuAssertIntEquals(tc, 0, wrtd_out_enable(wrtd_0, 0, 0));
CuAssertIntEquals(tc, 0, wrtd_out_enable(wrtd_0, 1, 0));
// Gather stats.
CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd_1, 0, &sti1)); CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd_1, 0, &sti1));
CuAssertIntEquals(tc, 0, wrtd_out_state_get(wrtd_0, 0, &sto1)); CuAssertIntEquals(tc, 0, wrtd_out_state_get(wrtd_0, 0, &sto1));
CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd_1, 1, &sti2)); CuAssertIntEquals(tc, 0, wrtd_in_state_get(wrtd_1, 1, &sti2));
...@@ -397,15 +400,11 @@ static void test_msg_time(CuTest *tc) ...@@ -397,15 +400,11 @@ static void test_msg_time(CuTest *tc)
/* Last sent trigger is the last executed */ /* Last sent trigger is the last executed */
CuAssertIntEquals(tc, sti1.last_sent.seq, sto1.last_executed.seq); CuAssertIntEquals(tc, sti1.last_sent.seq, sto1.last_executed.seq);
CuAssertIntEquals(tc, sti2.last_sent.seq, sto2.last_executed.seq);
CuAssertIntEquals(tc, 0, memcmp(&sti1.last_sent.id, CuAssertIntEquals(tc, 0, memcmp(&sti1.last_sent.id,
&sto1.last_executed.id, &sto1.last_executed.id,
sizeof(struct wrtd_trig_id))); sizeof(struct wrtd_trig_id)));
CuAssertIntEquals(tc, 0, memcmp(&sti2.last_sent.id,
&sto2.last_executed.id,
sizeof(struct wrtd_trig_id)));
// CuAssertIntEquals(tc, 0, wrtd_out_trig_unassign(wrtd_0, &h_1)); CuAssertIntEquals(tc, 0, wrtd_out_trig_unassign(wrtd_0, &h_1));
/* Close */ /* Close */
wrtd_close(wrtd_0); wrtd_close(wrtd_0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment