mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Merge pull request #8439 from yuhaoth/pr/add-test-suite-parameter-to-ssl-opt
Add test-suite parameter to filter tests
This commit is contained in:
		@@ -113,6 +113,7 @@ EXCLUDE='^$'
 | 
			
		||||
SHOW_TEST_NUMBER=0
 | 
			
		||||
LIST_TESTS=0
 | 
			
		||||
RUN_TEST_NUMBER=''
 | 
			
		||||
RUN_TEST_SUITE=''
 | 
			
		||||
 | 
			
		||||
PRESERVE_LOGS=0
 | 
			
		||||
 | 
			
		||||
@@ -137,6 +138,8 @@ print_usage() {
 | 
			
		||||
    printf "     --port     \tTCP/UDP port (default: randomish 1xxxx)\n"
 | 
			
		||||
    printf "     --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n"
 | 
			
		||||
    printf "     --seed     \tInteger seed value to use for this test run\n"
 | 
			
		||||
    printf "     --test-suite\tOnly matching test suites are executed\n"
 | 
			
		||||
    printf "                 \t(comma-separated, e.g. 'ssl-opt,tls13-compat')\n\n"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
get_options() {
 | 
			
		||||
@@ -175,6 +178,9 @@ get_options() {
 | 
			
		||||
            --seed)
 | 
			
		||||
                shift; SEED="$1"
 | 
			
		||||
                ;;
 | 
			
		||||
            --test-suite)
 | 
			
		||||
                shift; RUN_TEST_SUITE="$1"
 | 
			
		||||
                ;;
 | 
			
		||||
            -h|--help)
 | 
			
		||||
                print_usage
 | 
			
		||||
                exit 0
 | 
			
		||||
@@ -883,7 +889,7 @@ record_outcome() {
 | 
			
		||||
    if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ]; then
 | 
			
		||||
        printf '%s;%s;%s;%s;%s;%s\n' \
 | 
			
		||||
               "$MBEDTLS_TEST_PLATFORM" "$MBEDTLS_TEST_CONFIGURATION" \
 | 
			
		||||
               "ssl-opt" "$NAME" \
 | 
			
		||||
               "${TEST_SUITE_NAME:-ssl-opt}" "$NAME" \
 | 
			
		||||
               "$1" "${2-}" \
 | 
			
		||||
               >>"$MBEDTLS_TEST_OUTCOME_FILE"
 | 
			
		||||
    fi
 | 
			
		||||
@@ -1590,6 +1596,13 @@ run_test() {
 | 
			
		||||
        return
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Use ssl-opt as default test suite name. Also see record_outcome function
 | 
			
		||||
    if is_excluded_test_suite "${TEST_SUITE_NAME:-ssl-opt}"; then
 | 
			
		||||
        # Do not skip next test and skip current test.
 | 
			
		||||
        SKIP_NEXT="NO"
 | 
			
		||||
        return
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    print_name "$NAME"
 | 
			
		||||
 | 
			
		||||
    # Do we only run numbered tests?
 | 
			
		||||
@@ -1837,6 +1850,21 @@ else
 | 
			
		||||
    }
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Filter tests according to TEST_SUITE_NAME
 | 
			
		||||
is_excluded_test_suite () {
 | 
			
		||||
    if [ -n "$RUN_TEST_SUITE" ]
 | 
			
		||||
    then
 | 
			
		||||
        case ",$RUN_TEST_SUITE," in
 | 
			
		||||
            *",$1,"*) false;;
 | 
			
		||||
            *) true;;
 | 
			
		||||
        esac
 | 
			
		||||
    else
 | 
			
		||||
        false
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if [ "$LIST_TESTS" -eq 0 ];then
 | 
			
		||||
 | 
			
		||||
    # sanity checks, avoid an avalanche of errors
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user