-
Notifications
You must be signed in to change notification settings - Fork 25
Adding support for IGT tests #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
vsalipal
wants to merge
2
commits into
qualcomm-linux:main
from
vsalipal:Support-for-Display-IGT-Tests
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
.../Display/igt_gpu_tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <core_auth_bin_path> | ||
| ``` | ||
|
|
||
| **Method 2: Named argument** | ||
| ```bash | ||
| ./run.sh --core-auth-path <core_auth_bin_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 <this-repo> | ||
| cd <this-repo> | ||
| scp -r Runner user@target_device_ip:<Path in device> | ||
| ssh user@target_device_ip | ||
| ``` | ||
|
|
||
| - **Using Unified Runner** | ||
| ```bash | ||
| cd <Path in device>/Runner | ||
| ``` | ||
|
|
||
| - **Run Core_auth testcase** | ||
| ```bash | ||
| ./run-test.sh core_auth <core_auth_bin_path> | ||
| ``` | ||
|
|
||
| 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 - ================================= | ||
150 changes: 150 additions & 0 deletions
150
Runner/suites/Multimedia/Display/igt_gpu_tools/core_auth/run.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.