Skip to content

Disable ENGINE-based tests unless explicitly enabled #499

@VladGud

Description

@VladGud

Disable ENGINE-based tests unless explicitly enabled

Issue Summary

Modify the build system to conditionally compile and execute ENGINE-based tests only when the GOST_ENABLE_LEGACY build flag is explicitly set. Ensure that legacy ENGINE tests are opt-in and not built or run by default, aligning with the removal of ENGINE APIs.

Problem Description

The current test suite includes ENGINE-based tests that rely on deprecated and removed ENGINE APIs (§65–79). These tests prevent the project from building or running with OpenSSL configurations that disable deprecated functionality. To maintain compatibility with modern OpenSSL while preserving legacy test coverage, ENGINE-based tests must be made optional and disabled by default.

Current Implementation

  • Test files (e.g., test_ciphers.c, test_context.c, test_derive.c, test_digest.c, test_ecdhe.c, test_gost2814789.c, test_gost89.c, test_keyexpimp.c, test_mgm.c, test_params.c, test_sign.c, test_tls.c, test_tlstree.c) are compiled unconditionally
  • Some tests directly or indirectly use ENGINE APIs (e.g., via gost_eng.c or legacy EVP methods)
  • Tests with legacy engine environment are executed by default in CI and local builds

Required Changes

1. Identify ENGINE-dependent tests

  • Analyze test files to determine which ones use ENGINE APIs or legacy interfaces
  • Categorize tests into: provider-only (always built) and ENGINE-legacy (built only with GOST_ENABLE_LEGACY)

2. Update build system for conditional compilation

  • Modify CMakeLists.txt (or equivalent build files) to add a GOST_ENABLE_LEGACY option (default OFF)
  • Use conditional compilation (GOST_ENABLE_LEGACY) to include legacy test sources only when the flag is set
  • Ensure provider tests are always included

3. Isolate legacy test code

  • Move ENGINE-dependent test logic into separate files or wrap with #ifdef GOST_ENABLE_LEGACY guards
  • For tests that mix provider and ENGINE code, split into separate test functions or files

4. Update test execution

  • Modify test runners or scripts to skip legacy tests unless GOST_ENABLE_LEGACY is set
  • Ensure CI workflows (e.g., .cirrus.yml, workflows) respect the flag and do not run legacy tests by default

5. Document the flag

  • Update README.md or build documentation to explain the GOST_ENABLE_LEGACY flag and its purpose

Files to Modify

  • CMakeLists.txt: Add option(GOST_ENABLE_LEGACY "Enable legacy ENGINE support and tests" OFF) and conditional inclusion of legacy test sources
  • Test files (e.g., test_ciphers.c, test_context.c, etc.): Wrap ENGINE-dependent code with #ifdef GOST_ENABLE_LEGACY or move to separate legacy test files
  • workflows: Update CI to conditionally run legacy tests based on the flag

Dependencies

This task depends on:

  • Completion of moving ENGINE-based code to legacy modules (Problem compiling code #5)
  • Implementation of provider-native tests for modern functionality

Acceptance Criteria

  • Project builds successfully without GOST_ENABLE_LEGACY (no ENGINE tests compiled)
  • With GOST_ENABLE_LEGACY=ON, legacy tests are compiled and executable
  • Default builds (without flag) pass all provider tests and skip ENGINE tests
  • No ENGINE API usage in default builds
  • CI builds against OpenSSL master succeed without legacy flag

Testing

  • Build and run tests without GOST_ENABLE_LEGACY: Ensure no legacy tests are present, provider tests pass
  • Build and run tests with GOST_ENABLE_LEGACY=ON: Ensure legacy tests are included and pass
  • CI validation: Update workflows to test both modes (default without flag, and with flag for legacy coverage)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions