From 042dce6eda95fe744801e32b379e6ccdb9488548 Mon Sep 17 00:00:00 2001 From: vsalipal Date: Mon, 17 Nov 2025 15:07:00 +0530 Subject: [PATCH] Add Display IGT Core Auth test suite Add test files for Display IGT Core Authentication validation: - Display_IGT_Core_Auth_TestValidation_Readme.md: Documentation with usage instructions - run.sh: Script to execute and validate core_auth tests Signed-off-by: vsalipal --- ...lay_IGT_Core_Auth_TestValidation_Readme.md | 149 +++++++++++++++++ .../Display/igt-gpu-tools/core_auth/run.sh | 150 ++++++++++++++++++ 2 files changed, 299 insertions(+) create mode 100644 Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md new file mode 100644 index 00000000..00a1d86d --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md @@ -0,0 +1,149 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause-Clear + +# IGT Core Auth Test Script + +## Overview + +This script automates the validation of authentication mechanisms within the IGT Core framework. It performs a series of tests to ensure that the authentication processes are functioning correctly and securely. The script captures detailed logs and provides a comprehensive summary of the test results with subtest-level analysis. + +## Features + +- Comprehensive IGT authentication tests +- Environment setup for required dependencies +- Detailed logging of test processes and results +- Color-coded pass/fail summaries +- Output stored in structured results directory +- Auto-check for required libraries and dependencies +- Compatible with various Linux distributions +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- Core authentication binary (core_auth) - must be executable +- Required authentication libraries and dependencies +- Write access to the filesystem (for environment setup and logging) + +## Directory Structure +```bash +Runner/ +├──suites/ +├ ├── Multimedia/ +│ ├ ├── Display/ +│ ├ ├ ├── igt_gpu_tools/ +│ ├ ├ ├ ├── core_auth/ +│ ├ ├ ├ ├ ├── run.sh +├ ├ ├ ├ ├ └── Display_IGT_Core_Auth_TestValidation_Readme.md +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Positional argument** +```bash +./run.sh +``` + +**Method 2: Named argument** +```bash +./run.sh --core-auth-path +``` + +**Method 3: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh /usr/libexec/igt-gpu-tools/core_auth +./run.sh --core-auth-path /usr/libexec/igt-gpu-tools/core_auth +``` + +3. Logs and test results will be available in the test directory: + - `core_auth_log.txt` - Detailed test execution log with subtest results + - `core_auth.res` - Test result (PASS/FAIL/SKIP) + +## Output + +- **Console Output**: Real-time display of test execution and results with structured logging +- **Log File**: `core_auth_log.txt` - Contains detailed output from the core_auth binary including all subtests +- **Result File**: `core_auth.res` - Contains final test status (PASS/FAIL/SKIP) +- **Subtest Analysis**: Detailed parsing and counting of individual subtest results +- **Test Status Determination**: + - **FAIL**: Return code ≠ 0 OR any subtest failed (fail_count > 0) + - **SKIP**: Return code = 0 AND all subtests skipped (skip_count > 0, success_count = 0) + - **PASS**: Return code = 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The script requires the path to the core_auth binary (via positional or named argument). +- Enhanced argument validation includes checking for missing values in named parameters. +- Comprehensive validation ensures the core_auth binary exists and is executable. +- Automatic Weston compositor management using the `weston_stop` function from functestlib.sh. +- Built-in help system provides usage information with improved syntax display. +- Robust error handling with appropriate exit codes and result file generation. +- Test results are determined by both return codes and log content analysis. + +## Maintenance + +- Ensure the authentication libraries remain compatible with your system. +- Update test cases as per new authentication requirements or updates in the IGT Core framework. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run Core_auth testcase** +```bash +./run-test.sh core_auth +``` + +Example: +```bash +./run-test.sh core_auth /usr/libexec/igt-gpu-tools/core_auth +``` + +## EXAMPLE OUTPUT + +[Executing test case: core_auth] 2025-05-31 17:39:52 - +[INFO] 2025-05-31 17:39:52 - -------------------Starting core_auth Testcase----------------------------- +[INFO] 2025-05-31 17:39:52 - Using core_auth binary at: /usr/libexec/igt-gpu-tools/core_auth +[INFO] 2025-05-31 17:39:52 - Weston is not running. +[INFO] 2025-05-31 17:39:52 - Logs written to: /var/qcom-linux-testkit/Runner/suites/Multimedia/Display/core_auth/core_auth_log.txt +[INFO] 2025-05-31 17:39:52 - Subtest Results: SUCCESS=4, FAIL=0, SKIP=0, TOTAL=4 +[INFO] 2025-05-31 17:39:52 - results will be written to "./core_auth.res" +[INFO] 2025-05-31 17:39:52 - -------------------Completed core_auth Testcase---------------------------- +[PASS] 2025-05-31 17:39:52 - core_auth : Test Passed - All 4 subtest(s) succeeded +[PASS] 2025-05-31 17:39:52 - core_auth passed + +[INFO] 2025-05-31 17:39:52 - ========== Test Summary ========== +PASSED: +core_auth + +FAILED: + None + +SKIPPED: + None +[INFO] 2025-05-31 17:39:52 - ================================= diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh new file mode 100755 index 00000000..3934737b --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh @@ -0,0 +1,150 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# ---- Source init_env & tools ---- +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then INIT_ENV="$SEARCH/init_env"; break; fi + SEARCH="$(dirname "$SEARCH")" +done +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="core_auth" +result_file="./${TESTNAME}.res" +CORE_AUTH_CMD="" + +test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)" +if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then + test_path="$SCRIPT_DIR" +fi + +if [ ! -w "$test_path" ]; then + log_error "Cannot write to test directory: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --core-auth-path) + shift + if [ -n "${1:-}" ]; then + CORE_AUTH_CMD="$1" + else + log_error "Missing value for --core-auth-path parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --help|-h) + log_info "Usage: $0 [--core-auth-path BINARY_PATH] | [BINARY_PATH]" + exit 0 + ;; + -*) + log_warn "Unknown argument: $1" + ;; + *) + if [ -z "$CORE_AUTH_CMD" ]; then + CORE_AUTH_CMD="$1" + else + log_warn "Multiple paths specified, ignoring: $1" + fi + ;; + esac + shift +done + +if ! cd "$test_path"; then + log_error "cd failed: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +log_info "-------------------Starting $TESTNAME Testcase-----------------------------" + +if [ -z "$CORE_AUTH_CMD" ]; then + log_error "core_auth binary not specified" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +if [ ! -x "$CORE_AUTH_CMD" ]; then + log_error "FAIL: core_auth binary not found or not executable at: $CORE_AUTH_CMD" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_info "Using core_auth binary at: $CORE_AUTH_CMD" + +if ! weston_stop; then + log_error "Failed to stop Weston" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_file="$test_path/core_auth_log.txt" +"$CORE_AUTH_CMD" > "$log_file" 2>&1 +RC="$?" + +log_info "Logs written to: $log_file" + +success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0") +fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0") +skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0") + +# Ensure we have valid numbers +success_count=${success_count:-0} +fail_count=${fail_count:-0} +skip_count=${skip_count:-0} + +case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac +case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac +case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac + +total_subtests=$((success_count + fail_count + skip_count)) + +log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests" +log_info "results will be written to \"$result_file\"" +log_info "-------------------Completed $TESTNAME Testcase----------------------------" + +if [ "$RC" -ne 0 ]; then + log_fail "$TESTNAME : Test Failed (exit code: $RC)" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$fail_count" -gt 0 ]; then + log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then + log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped" + echo "$TESTNAME SKIP" > "$result_file" + exit 0 +else + if [ "$success_count" -gt 0 ]; then + if [ "$skip_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped" + else + log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded" + fi + else + log_pass "$TESTNAME : Test Passed (return code $RC)" + fi + echo "$TESTNAME PASS" > "$result_file" + exit 0 +fi