Skip to content

Generated tests for files with extern variables cannot be executed #610

Open
@IDKWNTCMF

Description

@IDKWNTCMF

Description
If a file contains extern variables then generated tests cannot be executed.

To Reproduce
Steps to reproduce the behavior:

  1. Generate tests for https://github.com/UnitTestBot/UTBotCpp/blob/main/integration-tests/c-example/lib/globals.c
  2. Try to run generated tests

Expected behavior
Tests are supposed to be executed successfully.

Actual behavior
An error test is generated with information about errors.

Visual proofs (screenshots, logs)

==17517==The following global variable is not properly aligned.
==17517==This may happen if another global with the same name
==17517==resides in another non-instrumented module.
==17517==Or the global comes from a C file built w/o -fno-common.
==17517==In either case this is likely an ODR violation bug,
==17517==but AddressSanitizer can not provide more details.
=================================================================
==17517==ERROR: AddressSanitizer: odr-violation (0x000000edd741):
  [1] size=1 'externed_global' /home/utbot/UTBotCpp/integration-tests/c-example/utbot_tests/makefiles/lib/structures/structs/../../../../../utbot_tests/wrapper/lib/../../../lib/static.c:4:7
  [2] size=1 'externed_global' /home/utbot/UTBotCpp/integration-tests/c-example/utbot_tests/makefiles/lib/structures/structs/../../../../../utbot_tests/wrapper/lib/../../../lib/static.c:4:7
These globals were registered at these points:
  [1]:
    #0 0x43aae8 in __asan_register_globals.part.0 /utbot_distr/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:360:3
    #1 0x7fe98e8fa5cb in asan.module_ctor (/home/utbot/UTBotCpp/integration-tests/c-example/utbot_tests/makefiles/lib/../../../build/lib/libliblib.a.so+0x495cb)

  [2]:
    #0 0x43aae8 in __asan_register_globals.part.0 /utbot_distr/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:360:3
    #1 0x7fe98e8fa5cb in asan.module_ctor (/home/utbot/UTBotCpp/integration-tests/c-example/utbot_tests/makefiles/lib/../../../build/lib/libliblib.a.so+0x495cb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions