From d2082ee94267e4ca59b187c5e37dac03c1d65187 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 31 Jan 2023 05:13:03 +0100 Subject: Merging upstream version 2.3. Signed-off-by: Daniel Baumann --- tests/README | 11 ++++++++-- tests/meson.build | 9 -------- tests/test-uint128.c | 62 ---------------------------------------------------- 3 files changed, 9 insertions(+), 73 deletions(-) delete mode 100644 tests/test-uint128.c (limited to 'tests') diff --git a/tests/README b/tests/README index 14b24e5..a5fa708 100644 --- a/tests/README +++ b/tests/README @@ -1,13 +1,20 @@ nvmetests ========= - This contains NVMe unit tests framework. The purpose of this framework + This contains a NVMe tests framework. The purpose of this framework to use nvme cli and test various supported commands and scenarios for NVMe device. - In current implementation this framework uses nvme cli to + In current implementation this framework uses nvme-cli to interact with underlying controller/namespace. + Note these tests expect to run against real hardware and will + read and write data to /dev/nvme0! + + DO NOT RUN THEM IF YOU DO NOT KNOW WHAT YOU ARE DOING! + + You have been warned. + 1. Common Package Dependencies ------------------------------ diff --git a/tests/meson.build b/tests/meson.build index 6f17137..630f35d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -55,15 +55,6 @@ if runtests.found() endforeach endif -test_uint128 = executable( - 'test-uint128', - ['test-uint128.c', '../util/types.c'], - include_directories: [incdir, '..'], - dependencies: [libnvme_dep], -) - -test('uint128', test_uint128) - python_module = import('python') python = python_module.find_installation('python3') diff --git a/tests/test-uint128.c b/tests/test-uint128.c deleted file mode 100644 index 6301a38..0000000 --- a/tests/test-uint128.c +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include -#include -#include - -#include "../util/types.h" - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - -/* create a uint128_t from four uint32_ts. w0 is the most significant value, - * w2 the least */ -#define U128(w0, w1, w2, w3) { .words = { w0, w1, w2, w3 } } - -static int test_rc; - -static void check_str(nvme_uint128_t val, const char *exp, const char *res) -{ - if (!strcmp(res, exp)) - return; - - printf("ERROR: printing {%08x.%08x.%08x.%08x}, got '%s', expected '%s'\n", - val.words[3], val.words[2], val.words[1], val.words[0], - res, exp); - - test_rc = 1; -} - -struct tostr_test { - nvme_uint128_t val; - const char *exp; -}; - -static struct tostr_test tostr_tests[] = { - { U128(0, 0, 0, 0), "0" }, - { U128(0, 0, 0, 1), "1" }, - { U128(0, 0, 0, 10), "10" }, - { U128(4, 3, 2, 1), "316912650112397582603894390785" }, - { - U128(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), - "340282366920938463463374607431768211455" - }, -}; - -void tostr_test(struct tostr_test *test) -{ - char *str; - str = uint128_t_to_string(test->val); - check_str(test->val, test->exp, str); -} - -int main(void) -{ - unsigned int i; - - test_rc = 0; - - for (i = 0; i < ARRAY_SIZE(tostr_tests); i++) - tostr_test(&tostr_tests[i]); - - return test_rc ? EXIT_FAILURE : EXIT_SUCCESS; -} -- cgit v1.2.3