Re: [PATCH v11 6/9] app/test: differentiate a strerror on different OS
From: Jie Zhou <hidden>
Date: 2021-12-06 17:25:04
On Sat, Dec 04, 2021 at 04:33:37AM +0300, Dmitry Kozlyuk wrote:
2021-12-02 16:06 (UTC-0800), Jie Zhou:quoted
On Windows, strerror returns just "Unknown error" for errnum greater than MAX_ERRNO, while linux and freebsd returns "Unknown error <num>", which is the current expectation for errno_autotest. Differentiate the error string on Windows to remove a "duplicate error code" failure. Signed-off-by: Jie Zhou <redacted> --- app/test/test_errno.c | 12 +++++++++++- lib/eal/common/eal_common_errno.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-)[...]quoted
diff --git a/lib/eal/common/eal_common_errno.c b/lib/eal/common/eal_common_errno.c index f86802705a..4c4abb802e 100644 --- a/lib/eal/common/eal_common_errno.c +++ b/lib/eal/common/eal_common_errno.c@@ -37,7 +37,11 @@ rte_strerror(int errnum) /* since some implementations of strerror_r throw an error * themselves if errnum is too big, we handle that case here */ if (errnum >= RTE_MAX_ERRNO) +#ifdef RTE_EXEC_ENV_WINDOWS + snprintf(ret, RETVAL_SZ, "Unknown error%s", sep);"sep" is not needed here, is it?
Yes, it is unnecessary. Removed. Thanks for spotting it.
quoted
+#else snprintf(ret, RETVAL_SZ, "Unknown error%s %d", sep, errnum); +#endif else switch (errnum){ case E_RTE_SECONDARY: