Commit 7f231a18 authored by Anas Nashif's avatar Anas Nashif Committed by Carles Cufi
Browse files

tests: net: tx_timestamp: move to new ztest API



Move to new ztest API.

Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent d17119c6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,3 +23,4 @@ CONFIG_NET_CONFIG_SETTINGS=n
CONFIG_NET_SHELL=n
CONFIG_NET_PKT_TIMESTAMP=y
CONFIG_NET_PKT_TIMESTAMP_THREAD=y
CONFIG_ZTEST_NEW_API=y
+16 −19
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ static void timestamp_callback(struct net_pkt *pkt)
	}
}

static void test_timestamp_setup(void)
void test_timestamp_setup(void)
{
	struct net_if *iface;
	struct net_pkt *pkt;
@@ -228,7 +228,7 @@ static void timestamp_callback_2(struct net_pkt *pkt)
	}
}

static void test_timestamp_setup_2nd_iface(void)
void test_timestamp_setup_2nd_iface(void)
{
	struct net_if *iface;
	struct net_pkt *pkt;
@@ -250,7 +250,7 @@ static void test_timestamp_setup_2nd_iface(void)
	zassert_equal(atomic_get(&pkt->atomic_ref), 0, "Pkt %p not released\n");
}

static void test_timestamp_setup_all(void)
void test_timestamp_setup_all(void)
{
	struct net_pkt *pkt;

@@ -277,7 +277,7 @@ static void test_timestamp_setup_all(void)
	net_if_unregister_timestamp_cb(&timestamp_cb_3);
}

static void test_timestamp_cleanup(void)
void test_timestamp_cleanup(void)
{
	struct net_if *iface;
	struct net_pkt *pkt;
@@ -341,7 +341,7 @@ static void iface_cb(struct net_if *iface, void *user_data)
	ud->total_if_count++;
}

static void test_address_setup(void)
void test_address_setup(void)
{
	struct net_if_addr *ifaddr;
	struct net_if *iface1, *iface2;
@@ -460,7 +460,7 @@ static void send_some_data(struct net_if *iface)
	net_context_unref(udp_v6_ctx);
}

static void test_check_timestamp_before_enabling(void)
void test_check_timestamp_before_enabling(void)
{
	test_started = true;
	do_timestamp = false;
@@ -473,7 +473,7 @@ static void test_check_timestamp_before_enabling(void)
	}
}

static void test_check_timestamp_after_enabling(void)
void test_check_timestamp_after_enabling(void)
{
	test_started = true;
	do_timestamp = true;
@@ -486,17 +486,14 @@ static void test_check_timestamp_after_enabling(void)
	}
}

void test_main(void)
ZTEST(net_tx_timestamp, test_tx_timestamp)
{
	ztest_test_suite(net_tx_timestamp_test,
			 ztest_unit_test(test_address_setup),
			 ztest_unit_test(test_check_timestamp_before_enabling),
			 ztest_unit_test(test_timestamp_setup),
			 ztest_unit_test(test_timestamp_setup_2nd_iface),
			 ztest_unit_test(test_timestamp_setup_all),
			 ztest_unit_test(test_check_timestamp_after_enabling),
			 ztest_unit_test(test_timestamp_cleanup)
			 );

	ztest_run_test_suite(net_tx_timestamp_test);
}
	test_address_setup();
	test_check_timestamp_before_enabling();
	test_timestamp_setup();
	test_timestamp_setup_2nd_iface();
	test_timestamp_setup_all();
	test_check_timestamp_after_enabling();
	test_timestamp_cleanup();
}
ZTEST_SUITE(net_tx_timestamp, NULL, NULL, NULL, NULL, NULL);