-
Notifications
You must be signed in to change notification settings - Fork 472
test: ctypes modules field incorrectly validated #13000
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
test/blackbox-tests/test-cases/ctypes/lib-no-modules-field.t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| Checking the validation of ctypes with no (modules) field works. | ||
|
|
||
| $ cat > dune-project <<EOF | ||
| > (lang dune 3.20) | ||
| > (using ctypes 0.3) | ||
| > EOF | ||
|
|
||
| $ mkdir bindings | ||
| $ cat > bindings/dune <<EOF | ||
| > (library (name mybindings)) | ||
| > EOF | ||
|
|
||
| $ cat > bindings/ffi_bindings.ml <<EOF | ||
| > module Types (F : Ctypes.TYPE) = struct end | ||
| > module Functions (F : Ctypes.FOREIGN) = struct end | ||
| > EOF | ||
|
|
||
| $ cat > dune <<EOF | ||
| > (library | ||
| > (name mylib) | ||
| > (libraries mybindings) | ||
| > (ctypes | ||
| > (external_library_name foo) | ||
| > (type_description (instance Types) (functor Ffi_bindings)) | ||
| > (function_description (instance Functions) (functor Ffi_bindings)) | ||
| > (generated_entry_point C))) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
| File "dune", lines 1-8, characters 0-245: | ||
| 1 | (library | ||
| 2 | (name mylib) | ||
| 3 | (libraries mybindings) | ||
| 4 | (ctypes | ||
| 5 | (external_library_name foo) | ||
| 6 | (type_description (instance Types) (functor Ffi_bindings)) | ||
| 7 | (function_description (instance Functions) (functor Ffi_bindings)) | ||
| 8 | (generated_entry_point C))) | ||
| Error: Module Ffi_bindings is required by ctypes at dune:6 but is missing in | ||
| the modules field of the stanza. | ||
| File "dune", lines 1-8, characters 0-245: | ||
| 1 | (library | ||
| 2 | (name mylib) | ||
| 3 | (libraries mybindings) | ||
| 4 | (ctypes | ||
| 5 | (external_library_name foo) | ||
| 6 | (type_description (instance Types) (functor Ffi_bindings)) | ||
| 7 | (function_description (instance Functions) (functor Ffi_bindings)) | ||
| 8 | (generated_entry_point C))) | ||
| Error: Module Ffi_bindings is required by ctypes at dune:7 but is missing in | ||
| the modules field of the stanza. | ||
| [1] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a plain-text explanation what is expected here and what is failing? That would make it easier to understand the failure case and expected behavior without knowing the entire context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
(ctypes (type_description (functor ...)))fields use a module that tells ctypes about the kind of interface to expect for the ffi. Some validation was added to make sure that the module came from the modules of the stanza in #12124. However this assumption is incorrect as there are people using this with this particular interface module coming from a separate location. More information can be found in #13001.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I mean in the cram file. So people reading it can understand what is going on without having to go through the git blame and the github issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update the test with explanation, sorry for being unclear.