test_a_custom_target_is_harvested_as_a_target

Tests › tests/test_cmake_generation.py

passed Passed in the packaged run.

What this test is for

Why it exists

`add_custom_target(... DEPENDS a b c)` names no OUTPUT — it is the aggregate that forces the rules above it to run, and mbedtls has two. Recording it as a `custom_command` would claim the target is a generated FILE.

Given

  1. src = b""" add_custom_target(mbedcrypto_generated_files_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/error.c ${CMAKE_CURRENT_BINARY_DIR}/version_features.c ) """
→

When

  1. rules = harvest_generation(_tree(src), src)["generated"]
→

Then

  1. ✓ len(rules) equals 1
  2. ✓ rules[0]["kind"] equals "custom_target"
  3. ✓ rules[0]["outputs"] equals []
  4. ✓ [d["name"] for d in rules[0]["depends"]] equals ["error.c", "version_features.c"]

tests/test_cmake_generation.py:177 · its file's page

What it checks (3)

  1. assert len(rules) == 1 and rules[0]["kind"] == "custom_target", rules observes harvest_generation via rules
  2. assert rules[0]["outputs"] == [], "a target produces no file of its own" observes harvest_generation via rules
  3. assert [d["name"] for d in rules[0]["depends"]] == ["error.c", "version_features.c"] observes harvest_generation via rules

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_a_custom_target_is_harvested_as_a_target→harvest_generation→_tree

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_a_custom_target_is_harvested_as_a_target · 3 checksharvest_generationREQ-DDB-PIPE-012 · measured
Also reaches 1 requirement

Its run touches their code; that is reach, not proof.