Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts with existing generated files #993

Closed
treiher opened this issue Apr 22, 2022 · 2 comments · Fixed by #1197 or #1198
Closed

Conflicts with existing generated files #993

treiher opened this issue Apr 22, 2022 · 2 comments · Fixed by #1197 or #1198
Assignees
Labels
small Effort of one person-day or less

Comments

@treiher
Copy link
Collaborator

treiher commented Apr 22, 2022

Using the same target directory for code generation for different specifications (or variants of a specification without clean up between two consecutive runs) can lead to conflicts, which just get visible during compilation. We should consider showing a warning or even abort when there are already files in the target directory.

@treiher treiher added this to To do in RecordFlux 0.6 via automation Apr 22, 2022
@senier senier removed this from To do in RecordFlux 0.6 Aug 23, 2022
@senier senier added this to To do in RecordFlux Future via automation Aug 23, 2022
@senier senier added the small Effort of one person-day or less label Aug 24, 2022
@senier senier removed this from Medium in RecordFlux Future Aug 30, 2022
@senier senier added this to To do in RecordFlux 0.7 via automation Aug 30, 2022
@senier senier moved this from To do to Implementation in RecordFlux 0.7 Sep 6, 2022
@senier senier self-assigned this Sep 6, 2022
@senier senier moved this from Implementation to To do in RecordFlux 0.7 Sep 15, 2022
@senier senier removed their assignment Sep 20, 2022
@senier senier moved this from To do to Implementation in RecordFlux 0.7 Sep 22, 2022
@senier senier self-assigned this Sep 22, 2022
senier added a commit that referenced this issue Sep 22, 2022
senier added a commit that referenced this issue Sep 22, 2022
@senier senier moved this from Implementation to Review in RecordFlux 0.7 Sep 22, 2022
senier added a commit that referenced this issue Sep 22, 2022
senier added a commit that referenced this issue Sep 22, 2022
senier added a commit that referenced this issue Sep 22, 2022
RecordFlux 0.7 automation moved this from Review to Done Sep 22, 2022
@jklmnn
Copy link
Member

jklmnn commented Sep 22, 2022

I just noticed the changes introduced with #1197 make make generate fail as it tries to generate multiple different packages into the same directory but then fails because common files like rflx-rflx_arithmetic.ads already exist:

make generate                     
tools/generate_spark_test_code.py
Parsing tests/data/specs/ethernet.rflx
Parsing tests/data/specs/in_ethernet.rflx
Parsing tests/data/specs/ipv4.rflx
Parsing tests/data/specs/in_ipv4.rflx
Parsing tests/data/specs/udp.rflx
Parsing tests/data/specs/icmp.rflx
Parsing tests/data/specs/ipv4.rflx
Parsing tests/data/specs/udp.rflx
Processing ICMP
Processing UDP
Processing IPv4
Processing Ethernet
Processing In_IPv4
Processing In_Ethernet
Generating ICMP::Tag
...
Creating tests/spark/generated/rflx-rflx_arithmetic.adb
Creating tests/spark/generated/rflx-rflx_generic_types-generic_operations.adb
Creating tests/spark/generated/rflx-rflx_message_sequence.adb
Creating tests/spark/generated/rflx-rflx_scalar_sequence.adb
Creating tests/spark/generated/rflx.ads
Generating TLV::Tag
Generating TLV::Length
Generating Derivation::Message
Creating tests/spark/generated/rflx-tlv.ads
Creating tests/spark/generated/rflx-derivation.ads
Creating tests/spark/generated/rflx-derivation-message.ads
Creating tests/spark/generated/rflx-derivation-message.adb
Creating tests/spark/generated/rflx-rflx_arithmetic.ads
Traceback (most recent call last):
  File "/.../RecordFlux/tools/generate_spark_test_code.py", line 75, in <module>
    sys.exit(main())
  File "/.../RecordFlux/tools/generate_spark_test_code.py", line 43, in main
    Generator(
  File "/.../RecordFlux/rflx/generator/generator.py", line 143, in generate
    self._write_files(units, directory, library_files, top_level_package)
  File "/.../RecordFlux/rflx/generator/generator.py", line 154, in _write_files
    self._write_library_files(directory)
  File "/.../RecordFlux/rflx/generator/generator.py", line 166, in _write_library_files
    create_file(
  File "/.../RecordFlux/rflx/generator/generator.py", line 1471, in create_file
    fail(f"file {filename} already exists", subsystem=Subsystem.GENERATOR)
  File "/.../RecordFlux/rflx/error.py", line 189, in fail
    _fail(RecordFluxError(), message, subsystem, severity, location)
  File "/.../RecordFlux/rflx/error.py", line 209, in _fail
    error.propagate()
  File "/.../RecordFlux/rflx/error.py", line 162, in propagate
    raise self
rflx.error.RecordFluxError: generator: error: file tests/spark/generated/rflx-rflx_arithmetic.ads already exists
make: *** [Makefile:162: generate] Error 1

@jklmnn jklmnn reopened this Sep 22, 2022
RecordFlux 0.7 automation moved this from Done to Implementation Sep 22, 2022
@treiher
Copy link
Collaborator Author

treiher commented Sep 22, 2022

Also, some tests are failing on main (and thus all rebased PRs) now:

=========================== short test summary info ============================
FAILED tests/integration/specification_model_generator_test.py::test_definite_message_with_builtin_type
FAILED tests/integration/specification_model_generator_test.py::test_definite_parameterized_message
FAILED tests/integration/specification_model_generator_test.py::test_parameterized_message
============= 3 failed, 23 passed, 8 skipped in 229.52s (0:03:49) ==============

This wasn't detected by the CI, because the verification tests were skipped.

treiher added a commit that referenced this issue Sep 22, 2022
treiher added a commit that referenced this issue Sep 22, 2022
treiher added a commit that referenced this issue Sep 23, 2022
@treiher treiher moved this from Implementation to Review in RecordFlux 0.7 Sep 23, 2022
RecordFlux 0.7 automation moved this from Review to Done Sep 23, 2022
treiher added a commit that referenced this issue Sep 23, 2022
treiher added a commit that referenced this issue Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
small Effort of one person-day or less
Projects
No open projects
3 participants