Skip to content

Generated test runners strip directory components from system includes #845

Description

@KaSroka

Environment

  • Ceedling 1.1.3 (1.1.3-049a9d7)
  • Ceedling 1.1.4 (1.1.4-e44173e)
  • GCC/Linux

Problem

When a test file directly includes a system header with a directory component:

#include <sys/stat.h>

the generated test runner contains:

#include "stat.h"

The directory component and system-include delimiters are lost, causing runner compilation to fail.

This affects both Ceedling 1.1.3 and 1.1.4, so it is not a 1.1.4 regression.

It is related to ThrowTheSwitch/Ceedling#1194, but that issue concerned includes propagated into generated Partials. The Partial path is fixed in 1.1.4; the generated test-runner path remains affected.

Reproduction

Create a project:

ceedling new runner-system-include-repro
cd runner-system-include-repro

test/test_runner_system_include.c

#include <sys/stat.h>

#include "unity.h"

void setUp(void)
{
}

void tearDown(void)
{
}

void test_runner_preserves_system_include_path(void)
{
    struct stat value;
    TEST_ASSERT_EQUAL_UINT(sizeof(value), sizeof(struct stat));
}

Run:

ceedling clobber test:all

Actual result

The test source itself compiles, but the generated runner fails:

build/test/runners/test_runner_system_include_runner.c:5:10:
fatal error: stat.h: No such file or directory
    5 | #include "stat.h"
      |          ^~~~~~~~

The generated runner contains:

#include "stat.h"

This was reproduced unchanged with both Ceedling 1.1.3 and 1.1.4.

Expected result

The generated runner should preserve the original include:

#include <sys/stat.h>

At minimum, both the directory component and the distinction between system and user includes should be retained.

Current workaround

A project-local forwarding header can mask the problem:

// test/support/stat.h
#include <sys/stat.h>

This workaround should not be necessary once the generated runner preserves the original include.

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