The previous commit introduced test_device_array(). Add five test cases to check its functionality. These test cases require the line below in the config: TEST_CASE_DEV_ARRAY[meta/02?]=/dev/XX /dev/XX should be a valid block device. Signed-off-by: Shin'ichiro Kawasaki --- tests/meta/020 | 14 ++++++++++++++ tests/meta/020.out | 2 ++ tests/meta/021 | 15 +++++++++++++++ tests/meta/021.out | 2 ++ tests/meta/022 | 17 +++++++++++++++++ tests/meta/022.out | 2 ++ tests/meta/023 | 17 +++++++++++++++++ tests/meta/023.out | 2 ++ tests/meta/024 | 13 +++++++++++++ tests/meta/024.out | 2 ++ 10 files changed, 86 insertions(+) create mode 100755 tests/meta/020 create mode 100644 tests/meta/020.out create mode 100755 tests/meta/021 create mode 100644 tests/meta/021.out create mode 100755 tests/meta/022 create mode 100644 tests/meta/022.out create mode 100755 tests/meta/023 create mode 100644 tests/meta/023.out create mode 100755 tests/meta/024 create mode 100644 tests/meta/024.out diff --git a/tests/meta/020 b/tests/meta/020 new file mode 100755 index 0000000..38fa920 --- /dev/null +++ b/tests/meta/020 @@ -0,0 +1,14 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Western Digital Corporation or its affiliates. +# +# Test test_device_array() + +. tests/meta/rc + +DESCRIPTION="do nothing in test_device_array()" + +test_device_array() { + echo "Running ${TEST_NAME}" + echo "Test complete" +} diff --git a/tests/meta/020.out b/tests/meta/020.out new file mode 100644 index 0000000..35e7722 --- /dev/null +++ b/tests/meta/020.out @@ -0,0 +1,2 @@ +Running meta/020 +Test complete diff --git a/tests/meta/021 b/tests/meta/021 new file mode 100755 index 0000000..731e6b3 --- /dev/null +++ b/tests/meta/021 @@ -0,0 +1,15 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Western Digital Corporation or its affiliates. +# +# Test test_device_array() + +. tests/meta/rc + +DESCRIPTION="exit with non-zero status from test_device_array()" + +test_device_array() { + echo "Running ${TEST_NAME}" + echo "Test complete" + return 1 +} diff --git a/tests/meta/021.out b/tests/meta/021.out new file mode 100644 index 0000000..25ee0fc --- /dev/null +++ b/tests/meta/021.out @@ -0,0 +1,2 @@ +Running meta/021 +Test complete diff --git a/tests/meta/022 b/tests/meta/022 new file mode 100755 index 0000000..8a853e7 --- /dev/null +++ b/tests/meta/022 @@ -0,0 +1,17 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Western Digital Corporation or its affiliates. +# +# Test skip in device_requries() for test_device_array() + +. tests/meta/rc + +DESCRIPTION="skip test_device_array() in device_requries()" + +device_requires() { + SKIP_REASONS+=("(╯°□°)╯︵ $TEST_DEV ┻━┻") +} + +test_device_array() { + echo '¯\_(ツ)_/¯' +} diff --git a/tests/meta/022.out b/tests/meta/022.out new file mode 100644 index 0000000..c335c68 --- /dev/null +++ b/tests/meta/022.out @@ -0,0 +1,2 @@ +Running meta/022 +Test complete diff --git a/tests/meta/023 b/tests/meta/023 new file mode 100755 index 0000000..646c216 --- /dev/null +++ b/tests/meta/023 @@ -0,0 +1,17 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Western Digital Corporation or its affiliates. +# +# Test requires() with test_device_array() + +. tests/meta/rc + +DESCRIPTION="skip test_device_array() in requires()" + +requires() { + SKIP_REASONS+=("(╯°□°)╯︵ ┻━┻") +} + +test_device_array() { + echo '¯\_(ツ)_/¯' +} diff --git a/tests/meta/023.out b/tests/meta/023.out new file mode 100644 index 0000000..a3b3c66 --- /dev/null +++ b/tests/meta/023.out @@ -0,0 +1,2 @@ +Running meta/023 +Test complete diff --git a/tests/meta/024 b/tests/meta/024 new file mode 100755 index 0000000..5d3b29e --- /dev/null +++ b/tests/meta/024 @@ -0,0 +1,13 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Western Digital Corporation or its affiliates. +# +# Test skipping from test_device_array() + +. tests/meta/rc + +DESCRIPTION="skip in test_device_array()" + +test_device_array() { + SKIP_REASONS+=("(╯°□°)╯︵ ┻━┻") +} diff --git a/tests/meta/024.out b/tests/meta/024.out new file mode 100644 index 0000000..c5be615 --- /dev/null +++ b/tests/meta/024.out @@ -0,0 +1,2 @@ +Running meta/024 +Test complete -- 2.51.0