From baf52c200236f338df15a1a55aabcf22255a2556 Mon Sep 17 00:00:00 2001 From: Qiao Zhao Date: Fri, 17 May 2024 14:30:29 +0800 Subject: [PATCH] initial opencsd rhel-10 gating tests Signed-off-by: Qiao Zhao --- gating.yaml | 6 ++++ tests/scripts/run_tests.sh | 59 ++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 11 +++++++ 3 files changed, 76 insertions(+) create mode 100644 gating.yaml create mode 100755 tests/scripts/run_tests.sh create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4ca9235 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 0000000..595140f --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,59 @@ +#!/usr/bin/bash + +if [[ ! $(uname -i) =~ "aarch64" ]]; then + echo "Only work on aarch64" + exit 0 +fi + +if rpm -q --quiet opencsd; then + : +else + sudo dnf install -y opencsd + if [[ $? != 0 ]]; then + echo "install of opencsd failed!" + exit 1 + fi +fi + +if [[ ! -f /usr/lib64/libopencsd.so.1 ]]; then + echo "/usr/lib64/libopencsd.so.1 not found!" + exit 2 +fi + +cat << EOF > csd.c +#include + +/* + * Check OpenCSD library version is sufficient to provide required features + */ +#define OCSD_MIN_VER ((1 << 16) | (2 << 8) | (1)) +#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER) +#error "OpenCSD >= 1.2.1 is required" +#endif + +int main(void) +{ + (void)ocsd_get_version(); + return 0; +} +EOF + +gcc -Wall -Werror -lopencsd_c_api -lopencsd -o csd csd.c +if [[ $? -ne 0 ]]; then + echo "Build against opencsd failed." + exit 3 +fi + +./csd +if [[ $? -ne 0 ]]; then + echo "OpenCSD runtime test failed." + exit 4 +fi + +ldd ./csd | grep -q -i opencsd +if [[ $? -ne 0 ]]; then + echo "test program does not link against opencsd, please investigate." + exit 5 +fi + +exit 0 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..52e1743 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,11 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple: + dir: scripts + run: ./run_tests.sh + required_packages: + - opencsd opencsd-devel gcc