Skip to content

test: add test for anonymous version definition diagnostic#1153

Open
sai18022001 wants to merge 1 commit into
qualcomm:mainfrom
sai18022001:fix/issue-1124-anon-version-def-test-v2
Open

test: add test for anonymous version definition diagnostic#1153
sai18022001 wants to merge 1 commit into
qualcomm:mainfrom
sai18022001:fix/issue-1124-anon-version-def-test-v2

Conversation

@sai18022001
Copy link
Copy Markdown

@sai18022001 sai18022001 commented May 10, 2026

Fixes #1124

Adds a lit test covering the error diagnostic emitted when an anonymous
version definition is used in combination with other named version
definitions in a version script.

Problem :
The diagnostic anonymous version definition is used in combination with other version definitions (emitted in ScriptParser::readVersionScriptCommand())
had no test coverage.

Solution :
Added a new lit test at test/Common/standalone/VersionScriptAnonymousMixed/
with the following files:

  • Inputs/1.c — minimal C source file to produce an object file for linking
  • Inputs/vs_mixed — version script mixing a named and anonymous version node to trigger the diagnostic
  • VersionScriptAnonymousMixed.test — compiles 1.c into an object file,
    links it as a shared library with vs_mixed via --version-script=,
    expects the link to fail (%not), and verifies the error message using
    FileCheck

Testing :
Tested on AArch64, ARM, RISCV, RISCV64, Hexagon, x86 - > all pass.

@@ -0,0 +1,14 @@
UNSUPPORTED: x86
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required to explicitly disable the x86 architecture here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required actually

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, can you please remove it?

# Test that an error is emitted when an anonymous version definition
# is used in combination with other named version definitions
# in a version script.
# See: https://github.com/qualcomm/eld/issues/1124
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# See: https://github.com/qualcomm/eld/issues/1124

@@ -0,0 +1,6 @@
VER_1.0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add a test where anonymous version is first and then we have named version node?

Copy link
Copy Markdown
Author

@sai18022001 sai18022001 May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parth-07
The anonymous-first case produces a different error: EOF expected, but got VER_1.0 rather than the anonymous version definition is used in combination with other version definitions .
Should I add a separate CHECK for that error ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please add a separate check for that.

Add a lit test covering the error diagnostics emitted when an
anonymous version definition is used in combination with other
named version definitions in a version script.

Two cases are tested:
- Named version node first, anonymous second: emits 'anonymous
  version definition is used in combination with other version
  definitions'
- Anonymous version node first, named second: emits 'EOF expected,
  but got VER_1.0'

Test location: test/Common/standalone/VersionScriptAnonymousMixed/

Fixes qualcomm#1124

Signed-off-by: Sai Sanjay Chikne <saichikne180201@gmail.com>
@sai18022001 sai18022001 force-pushed the fix/issue-1124-anon-version-def-test-v2 branch from c4f41f0 to c849c41 Compare May 14, 2026 18:58
@sai18022001 sai18022001 requested a review from parth-07 May 14, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no test for the error anonymous version definition is used in combination with other version definitions

2 participants