From patchwork Thu Oct 14 03:30:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Zhou X-Patchwork-Id: 101526 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62D0FA0C4B; Thu, 14 Oct 2021 05:30:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 934E841172; Thu, 14 Oct 2021 05:30:25 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 65B5C41159 for ; Thu, 14 Oct 2021 05:30:20 +0200 (CEST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id B71D220B9D0D; Wed, 13 Oct 2021 20:30:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B71D220B9D0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1634182219; bh=uLLFv59qdaWMxOymYXBiaNmgQD2QOj7VuthvQ2n3lf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHdgu9XiHjjjWI5XlbtKKrPYzka2pGp1EH5DuxhBg5VyMWftXVdHxHzgrUH8WEkuF /dXU0ZXLYHvHGOzE4llddrYzGa1StMf7hMYe8IFAHFwpX9IcHVsB5f6EY9bWwm27iv zz8lDm5HdCYUamc9WNbTP3CeyLyDNa8k8NWcIPQo= From: Jie Zhou To: dev@dpdk.org Cc: dmitry.kozliuk@gmail.com, roretzla@microsoft.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, pallavi.kadam@intel.com, talshn@nvidia.com, thomas@monjalon.net, aconole@redhat.com Date: Wed, 13 Oct 2021 20:30:06 -0700 Message-Id: <1634182214-24540-5-git-send-email-jizh@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1634182214-24540-1-git-send-email-jizh@linux.microsoft.com> References: <1630729155-24584-1-git-send-email-jizh@linux.microsoft.com> <1634182214-24540-1-git-send-email-jizh@linux.microsoft.com> Subject: [dpdk-dev] [PATCH v4 04/12] app/test: replace POSIX specific code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" - Include rte_os_shim.h - Replace sleep and usleep with rte_delay_us_sleep - #ifndef RTE_EXEC_ENV_WINDOWS for POSIX code only Signed-off-by: Jie Zhou --- app/test/packet_burst_generator.c | 1 + app/test/process.h | 4 +++- app/test/test.c | 4 ++++ app/test/test_byteorder.c | 2 +- app/test/test_cmdline.c | 2 ++ app/test/test_crc.c | 1 - app/test/test_mp_secondary.c | 2 ++ app/test/test_pmd_perf.c | 6 +++++- app/test/test_ring_stress.c | 3 ++- app/test/test_ring_stress_impl.h | 2 +- app/test/test_telemetry_data.c | 2 ++ 11 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 8ac24577ba..6b42b9b83b 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "packet_burst_generator.h" diff --git a/app/test/process.h b/app/test/process.h index 5b10cf64df..1f073b9c5c 100644 --- a/app/test/process.h +++ b/app/test/process.h @@ -7,12 +7,14 @@ #include /* errno */ #include /* PATH_MAX */ +#ifndef RTE_EXEC_ENV_WINDOWS #include /* basename et al */ +#include +#endif #include /* NULL */ #include /* strerror */ #include /* readlink */ #include -#include #include /* strlcpy */ diff --git a/app/test/test.c b/app/test/test.c index 52fac24213..e8f8ce8335 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -62,7 +62,9 @@ do_recursive_call(void) const char *env_var; int (*action_fn)(void); } actions[] = { +#ifndef RTE_EXEC_ENV_WINDOWS { "run_secondary_instances", test_mp_secondary }, +#endif #ifdef RTE_LIB_PDUMP #ifdef RTE_NET_RING { "run_pdump_server_tests", test_pdump }, @@ -81,7 +83,9 @@ do_recursive_call(void) { "test_file_prefix", no_action }, { "test_no_huge_flag", no_action }, #ifdef RTE_LIB_TIMER +#ifndef RTE_EXEC_ENV_WINDOWS { "timer_secondary_spawn_wait", test_timer_secondary }, +#endif #endif }; diff --git a/app/test/test_byteorder.c b/app/test/test_byteorder.c index 03c08d9abf..de14ed539e 100644 --- a/app/test/test_byteorder.c +++ b/app/test/test_byteorder.c @@ -46,7 +46,7 @@ test_byteorder(void) return -1; res_u16 = rte_bswap16(0x1337); - printf("const %"PRIx16" -> %"PRIx16"\n", 0x1337, res_u16); + printf("const %"PRIx16" -> %"PRIx16"\n", (uint16_t)0x1337, res_u16); if (res_u16 != 0x3713) return -1; diff --git a/app/test/test_cmdline.c b/app/test/test_cmdline.c index 115bee966d..9a76bd299f 100644 --- a/app/test/test_cmdline.c +++ b/app/test/test_cmdline.c @@ -31,6 +31,7 @@ test_cmdline(void) return -1; if (test_parse_num_invalid_param() < 0) return -1; +#ifndef RTE_EXEC_ENV_WINDOWS printf("Testing parsing IP addresses...\n"); if (test_parse_ipaddr_valid() < 0) return -1; @@ -38,6 +39,7 @@ test_cmdline(void) return -1; if (test_parse_ipaddr_invalid_param() < 0) return -1; +#endif printf("Testing parsing strings...\n"); if (test_parse_string_valid() < 0) return -1; diff --git a/app/test/test_crc.c b/app/test/test_crc.c index bf1d344359..0ed080e482 100644 --- a/app/test/test_crc.c +++ b/app/test/test_crc.c @@ -14,7 +14,6 @@ #define CRC32_VEC_LEN2 348 #define CRC16_VEC_LEN1 12 #define CRC16_VEC_LEN2 2 -#define LINE_LEN 75 /* CRC test vector */ static const uint8_t crc_vec[CRC_VEC_LEN] = { diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index 5b6f05dbb1..da035348bd 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -14,7 +14,9 @@ #include #include #include +#ifndef RTE_EXEC_ENV_WINDOWS #include +#endif #include #include #include diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 3a248d512c..8698d24eac 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -298,6 +298,7 @@ reset_count(void) idle = 0; } +#ifndef RTE_EXEC_ENV_WINDOWS static void stats_display(uint16_t port_id) { @@ -327,6 +328,7 @@ signal_handler(int signum) if (signum == SIGUSR2) stats_display(0); } +#endif struct rte_mbuf **tx_burst; @@ -638,7 +640,7 @@ exec_burst(uint32_t flags, int lcore) i = (i >= conf->nb_ports - 1) ? 0 : (i + 1); } - sleep(5); + rte_delay_us(5 * US_PER_S); /* only when polling second */ if (flags == SC_BURST_XMIT_FIRST) @@ -669,8 +671,10 @@ test_pmd_perf(void) printf("Start PMD RXTX cycles cost test.\n"); +#ifndef RTE_EXEC_ENV_WINDOWS signal(SIGUSR1, signal_handler); signal(SIGUSR2, signal_handler); +#endif nb_ports = rte_eth_dev_count_avail(); if (nb_ports < NB_ETHPORTS_USED) { diff --git a/app/test/test_ring_stress.c b/app/test/test_ring_stress.c index 1af45e0fc8..ce3535c6b2 100644 --- a/app/test/test_ring_stress.c +++ b/app/test/test_ring_stress.c @@ -43,9 +43,10 @@ test_ring_stress(void) n += test_ring_rts_stress.nb_case; k += run_test(&test_ring_rts_stress); +#ifndef RTE_EXEC_ENV_WINDOWS n += test_ring_hts_stress.nb_case; k += run_test(&test_ring_hts_stress); - +#endif n += test_ring_mt_peek_stress.nb_case; k += run_test(&test_ring_mt_peek_stress); diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h index f9ca63b908..feb4b96ea1 100644 --- a/app/test/test_ring_stress_impl.h +++ b/app/test/test_ring_stress_impl.h @@ -359,7 +359,7 @@ test_mt1(int (*test)(void *)) wrk_cmd = WRK_CMD_RUN; rte_smp_wmb(); - usleep(run_time * US_PER_S); + rte_delay_us(run_time * US_PER_S); /* signal worker to start test */ wrk_cmd = WRK_CMD_STOP; diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c index 18b93db8ef..73eee293a1 100644 --- a/app/test/test_telemetry_data.c +++ b/app/test/test_telemetry_data.c @@ -4,7 +4,9 @@ #include #include +#ifndef RTE_EXEC_ENV_WINDOWS #include +#endif #include #include