Commit Graph

323 Commits

Author SHA1 Message Date
Giacomo Vercesi 89b17d2325 Python client: add user manual 2025-05-07 12:04:15 +02:00
Giacomo Vercesi 890a735610 test_docs: add ignoreoutput option for python
Sometimes the output of a command is not important, in these cases
`doctest` complains nonetheless. This commit introduces a
`IGNORE_OUTPUT` option which still allows checking that the command
executes correctly but skips the checking of the output with the
expected one. In addition to this the `test_docs` command now can parse
a `ignoreoutput` option in the python block which will:
* if numbers are specified (e.g. `ignoreoutput=1,2`): the specified
  line numbers will have `# doctest: +IGNORE_OUTPUT` added at the end
  of the specified line numbers.
* Without numbers (e.g. `{python ignoreoutput}`) then all lines will
  have a `# doctest: +IGNORE_OUTPUT` appended.
2025-05-07 10:48:54 +02:00
Giacomo Vercesi 3e3779498e Implement python interface for revng
Add a python interface (`revng.profile`) for interacting with the rev.ng
infrastructure as a whole; either through the CLI (`CLIProject`) or the
GraphQL API (`DaemonProject`).
2025-05-07 10:48:51 +02:00
Giacomo Vercesi de997ca2e4 python TTG: add mixins infrastructure
Add the infrastructure code needed to allow to add mixins to Tuple-Tree
Generated classes in python.
2025-05-07 10:48:50 +02:00
Giacomo Vercesi 0f6b6e00bd Add revng init
Add a new `revng` command that allows to initialize a resume directory.
2025-05-07 10:48:49 +02:00
Giacomo Vercesi 8ba134bb45 TypedList: also implement mapping functions
Allow `TypedList`s to also be used as a dictionary-like structure if
the base class is keyable.
2025-05-07 10:48:47 +02:00
Giacomo Vercesi d8fffc0980 Improve Python's TTG typing
Improve the typing signatures in a few place in the `revng.tupletree`
package and in the auto-generated python TTGs.
2025-05-07 10:48:46 +02:00
Jurij Srebrnič 3050b291b1 Implement diff and apply for python model wrapper
Add the necessary code for the python model wrapper to allow diffing and
applying a diff.
2025-05-07 10:48:45 +02:00
Jurij Srebrnič 3bc63b833e Fixed python and typescript doc-test not executing 2025-05-07 10:48:23 +02:00
Giacomo Vercesi e95ad01ff8 Implement revng llm-rename 2025-05-05 17:28:48 +02:00
Giacomo Vercesi 591107cdce Overhaul PTML functionality
The logic of the `revng ptml` command was too tightly coupled with the
parsing of the xml. Overhaul the structure of the ptml code and split it
in two locations:
* `revng.ptml`: this module contains functions that allow easy
  manipulation of PTML, both for printing it and for obtaining the split
  metadata/text version.
* `revng.internal.cli._commands.ptml`: this implements the actual `revng
  ptml` command. This leverages the new logic in the `revng.ptml` module
  while maintaining the same functionality.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi bfed42ed1e Add revng.support.get_llvmcpy helper
Add the `get_llvmcpy` helper function which returns an instance of
`LLVMCPy` which uses the `llvm-config` that's present in the search
paths.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 6fc6d38228 Remove argparse.FileType
Python 3.14 will deprecate `argparse.FileType` [1]. This is due to a
variety of factors, one of which is that the class leaks file
descriptors when used. Remove all usages in the codebase and instead
use a wrapper function for `open`.

[1] https://docs.python.org/3.14/library/argparse.html#argparse.FileType
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 57c4f89dd3 python: remove relative imports
Remove all the relative imports from the python code that are not
relative to the current module (e.g. `from .<X> import ...`).
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 4757d57d59 StorageSaver: fetch initial credentials
Fetch the credentials contained in the URL from the `Synchronizer` when
initializing `StorageSaver`.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 19a3eb39c6 tupletree: suppress naming error
Suppress the flake8 error N808, due to the variables beginning with `_`.
2025-05-05 16:02:40 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 8b355fc896 Add primitive support for generating migrations 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 9b07b3bcce Add primitive migration support to the CLI 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 7156cace7b Drop multiversion support in Python model wrapper 2025-04-30 15:08:45 +02:00
Giacomo Vercesi 6509cad084 test_docs: remove useless global
The `verbose` was is not modified in the `log` function, so the use of
`global` is useless.
2025-04-24 13:22:14 +02:00
Ivan Krysak ae3f19664a ModelPasses: introduce fix-model 2025-04-17 11:19:17 +03:00
Ivan Krysak 0c99d5d5fb IDBImporter: omit unnecessary typedefs 2025-04-17 11:19:17 +03:00
Ivan Krysak 2eed7f2410 IDBImporter: fix an incorrect type check 2025-04-17 11:19:17 +03:00
Ivan Krysak c4f071dfe3 Importers: adopt primitive typedef flattening 2025-04-17 11:19:17 +03:00
Ivan Krysak 433af9ef6e Adopt the new name deduplication pass 2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Giacomo Vercesi 38aefea930 ResettableTimer: fix deadlock
The `ResettableTimer` class' code did not account for the `function`
attribute to possibly call the timer, creating a deadlock because the
lock was already taken while calling the function. Move the function
call out of the lock.
2025-04-07 10:36:36 +02:00
Giacomo Vercesi e634861c1a Implement SyncingManager
Implement the SyncingManager class which wraps the Manager and implements
save syncing features, which comprise autosave and saving via
synchronizers.
2025-04-03 15:59:18 +02:00
Giacomo Vercesi 6a10419b69 Implement S3Synchronizer
Implement a downstream load/save handler in `revng.internal.api.Manager`
class which handles loading and saving files from a local directory to
a s3 server.
2025-03-28 14:23:10 +01:00
Giacomo Vercesi d9e928dce9 fetch debuginfo: provide alternative urls via env
Allow the `fetch debuginfo` command to have the upstream server urls be
provided via environment variables rather than the command-line.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi f6b9e509a3 fetch debuginfo: actually check for PE/COFF
Add the code needed to check if the input file is actually a PE/COFF
file.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi fa44c4cf2f fetch debuginfo: drop self.verbose
The `FetchDebugInfoCommand` contained assignment to `self.verbose` which
was unused. Drop it.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi ca26c06ecc EventManager: fix save logic
Fix the save logic of `EventManager` where an erroneous comparison lead
to the saves never being triggered.
2025-02-25 09:18:24 +01:00
Giacomo Vercesi 74cbb83d10 fetch-debuginfo: add retries
Add retries when fetching debugging symbols via the `revng model
fetch-debuginfo` command. Retries only apply when the status code
returned by the server is within the expected ones.
2025-02-24 18:17:47 +01:00
Giacomo Vercesi f6f512883a revng daemon: add save mutation
Add the `save` mutation to the GraphQL api. This allows a client to
trigger saving.
2024-12-20 12:24:34 +01:00
Giacomo Vercesi 319b558ddb EventManager: change saving logic
Switch the saving logic of EventManager from 5 minutes of inactivity to
every 2 minutes, regardless of user interaction. However if the user
does not interact, then consecutive saves will not be made.
2024-12-20 12:24:28 +01:00
Giacomo Vercesi 878356bd57 revng ptml: drop c.comparison PTML token
The `c.comparison` token was dropped by commit
0812989cb0, drop it also in the color
conversion table of `revng ptml`.
2024-12-20 12:24:28 +01:00
Alessandro Di Federico 620d142d53 Reroganize and expand documentation 2024-12-11 16:15:37 +01:00
Alessandro Di Federico 0c7c20ad48 Introduce model, artifacts and analyses references 2024-12-11 16:15:27 +01:00
Alessandro Di Federico 5b7703aff3 Minor changes 2024-12-11 16:15:09 +01:00
Giacomo Vercesi 70217f00c9 revng opt: drop unwrapping of zstd modules
Drop support of uncompressing zstd-compressed modules in `revng opt` as
this functionality has been moved within `llvm`.

(This is a revert of commit dd8d158e47)
2024-11-26 11:30:19 +01:00
Giacomo Vercesi 046be11be2 revng graphql: gracefully terminate daemon
When stopping an internal daemon, first try to use SIGINT and then
resort to SIGKILL. This is to avoid the signal handler exiting with a
non-zero return code during shutdown.
2024-11-25 17:52:27 +01:00
Giacomo Vercesi 9ee719f2c2 ptml/common: fix missing kwargs
Add the missing `kwargs` to the invocation of the wrapped `func` in
`suppress_brokenpipe`.
2024-11-22 16:05:16 +01:00
Giacomo Vercesi 38cd15d755 fetch_debuginfo: fix race condition
Fix a possible race condition that could arise if multiple instances of
`fetch-debuginfo` are run in parallel. This avoids the same file being
written by multiple processes and being moved early. This avoids a
`FileNotFoundError` and possibly data corruption due to the concurrent
situation.
2024-11-13 09:28:12 +01:00
Alessandro Di Federico efcea8ae48 importBinary: fix error handling 2024-11-12 18:05:48 +01:00
Alessandro Di Federico ba186a130c s/module.ll/module.bc.zstd/g 2024-11-12 14:58:00 +01:00
Giacomo Vercesi f0a5a48c8e mass-testing: generate crash graphs for OOMs
Add graph/crash statistics generation for the OOM category as well.
2024-10-31 08:58:59 +01:00
Giacomo Vercesi 023b470473 mass-testing: implement cmd/env overrides
Implement override mechanisms via command-line and/or env for the
following aspects:
* The maximum memory set by `test-harness`
* The timeout handled by `test-harness`
* The number of concurrent jobs to spawn while running `revng mass-testing run`
2024-10-31 08:58:59 +01:00
Giacomo Vercesi 208e18cedb revng.internal.cli: unify temporary_file
Unify the logic responsible for the `temporary_file` function, since its
body was duplicated three times over the codebase.
2024-10-31 08:58:59 +01:00