Skip to content

Commit 489a5f8

Browse files
committed
use retdec-decompiler instead of retdec-decompiler.py
1 parent 871f39a commit 489a5f8

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome to Regression Tests' Documentation!
88

99
This is a documentation for the `regression tests framework <https://github.com/avast/retdec-regression-tests-framework/>`_. It describes how to write regression tests for `RetDec <https://github.com/avast/retdec/>`_ and its tools, and provides an overview of the supported functions and methods.
1010

11-
The documentation is primarily focused on tests for the RetDec decompiler, i.e. for the ``retdec-decompiler.py`` script. You can, however, write tests for arbitrary RetDec-related tools, such as ``fileinfo`` or ``unpacker``. This is described in section :doc:`tests_for_arbitrary_tools`. Nevertheless, it is highly recommended to read the whole documentation, even if you plan to write tests only for a single tool.
11+
The documentation is primarily focused on tests for the RetDec decompiler, i.e. for the ``retdec-decompiler`` script. You can, however, write tests for arbitrary RetDec-related tools, such as ``fileinfo`` or ``unpacker``. This is described in section :doc:`tests_for_arbitrary_tools`. Nevertheless, it is highly recommended to read the whole documentation, even if you plan to write tests only for a single tool.
1212

1313
Table of Contents
1414
=================

docs/test_settings.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ The name can by any valid Python identifier, written conventionally in ``snake_c
2727
arch='x86'
2828
)
2929
30-
From the above settings, the following ``retdec-decompiler.py`` argument list is automatically created:
30+
From the above settings, the following ``retdec-decompiler`` argument list is automatically created:
3131

3232
.. code-block:: text
3333
34-
retdec-decompiler.py file.exe -a x86
34+
retdec-decompiler file.exe -a x86
3535
3636
For a complete list of possible arguments to the initializer, see the description of :class:`~tools.decompiler_test_settings.DecompilerTestSettings`.
3737

@@ -48,8 +48,8 @@ For such settings, the following two decompilations are run:
4848

4949
.. code-block:: text
5050
51-
retdec-decompiler.py file.exe -a x86
52-
retdec-decompiler.py file.exe -a arm
51+
retdec-decompiler file.exe -a x86
52+
retdec-decompiler file.exe -a arm
5353
5454
That is, the regression tests framework runs a single decompilation for every combination of the values specified in the settings.
5555

@@ -122,7 +122,7 @@ We want to decompile ``file1.exe`` on ``x86`` and ``arm``, and ``file2.elf`` on
122122
Arbitrary Parameters for the Decompiler
123123
---------------------------------------
124124

125-
If you look at the complete list of possible arguments (:class:`~tools.decompiler_test_settings.DecompilerTestSettings`), you see that not all ``retdec-decompiler.py`` parameters may be specified as arguments to :class:`TestSettings`. The reason is that ``retdec-decompiler.py`` provides too many parameters and their support in the form of arguments would be cumbersome. However, it is possible to specify arbitrary arguments that are directly passed to the ``retdec-decompiler.py`` script via the ``args`` argument:
125+
If you look at the complete list of possible arguments (:class:`~tools.decompiler_test_settings.DecompilerTestSettings`), you see that not all ``retdec-decompiler`` parameters may be specified as arguments to :class:`TestSettings`. The reason is that ``retdec-decompiler`` provides too many parameters and their support in the form of arguments would be cumbersome. However, it is possible to specify arbitrary arguments that are directly passed to the ``retdec-decompiler`` via the ``args`` argument:
126126

127127
.. code-block:: python
128128
@@ -137,17 +137,17 @@ These settings result into the creation of the following decompilation:
137137

138138
.. code-block:: text
139139
140-
retdec-decompiler.py file.exe -a x86 --select-decode-only --select-functions func1,func2
140+
retdec-decompiler file.exe -a x86 --select-decode-only --select-functions func1,func2
141141
142-
In a greater detail, the ``args`` argument is taken, split into sub-arguments by whitespace, and passed to the ``retdec-decompiler.py`` script. The argument list internally looks like this:
142+
In a greater detail, the ``args`` argument is taken, split into sub-arguments by whitespace, and passed to the ``retdec-decompiler``. The argument list internally looks like this:
143143

144144
.. code-block:: python
145145
146146
['file.exe', '-a', 'x86', '--select-decode-only', '--select-functions', 'func1,func2']
147147
148148
.. hint::
149149

150-
When it is possible to specify a ``retdec-decompiler.py`` parameter in the form of a named argument (like architecture or endianness), always prefer it to specifying raw arguments by using the ``args`` argument. That is, do **not** write
150+
When it is possible to specify a ``retdec-decompiler`` parameter in the form of a named argument (like architecture or endianness), always prefer it to specifying raw arguments by using the ``args`` argument. That is, do **not** write
151151

152152
.. code-block:: python
153153
@@ -157,7 +157,7 @@ In a greater detail, the ``args`` argument is taken, split into sub-arguments by
157157
args='-a x86' # Always prefer using arch='x86'.
158158
)
159159
160-
The reason is that named arguments are less prone to changes in ``retdec-decompiler.py``. Indeed, when such an argument changes in ``retdec-decompiler.py``, all that has to be done is changing the internal mapping of named arguments to ``retdec-decompiler.py`` arguments. No test needs to be changed.
160+
The reason is that named arguments are less prone to changes in ``retdec-decompiler``. Indeed, when such an argument changes in ``retdec-decompiler``, all that has to be done is changing the internal mapping of named arguments to ``retdec-decompiler`` arguments. No test needs to be changed.
161161

162162
If you want to specify separate arguments for several decompilations for single settings, place them into a list when specifying the settings. For example, consider the following test class:
163163

@@ -177,8 +177,8 @@ It results into these two decompilations:
177177

178178
.. code-block:: text
179179
180-
retdec-decompiler.py file.elf -a x86 --select-decode-only --select-functions func1,func2
181-
retdec-decompiler.py file.elf -a x86 --select-decode-only --select-functions func3
180+
retdec-decompiler file.elf -a x86 --select-decode-only --select-functions func1,func2
181+
retdec-decompiler file.elf -a x86 --select-decode-only --select-functions func3
182182
183183
You can also specify multiple settings, as already described earlier in this section.
184184

regression_tests/tools/decompiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def fileinfo_outputs(self):
138138
(?:
139139
\#\#\#\#\#\ # Ended correctly.
140140
|
141-
\./retdec-decompiler.py:\ line\ \d+: # Failed (segfault etc.).
141+
\./retdec-decompiler:\ line\ \d+: # Failed (segfault etc.).
142142
)
143143
""", self.log, re.VERBOSE | re.MULTILINE | re.DOTALL)
144144
return [FileinfoOutput(output.strip()) for output in outputs]

regression_tests/tools/decompiler_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _tool_class(self):
1717

1818
@overrides(ToolRunner)
1919
def _get_tool_executable_name(self, tool_name):
20-
return 'retdec-decompiler.py'
20+
return 'retdec-decompiler'
2121

2222
@overrides(ToolRunner)
2323
def _initialize_tool_dir_and_args(self, dir, args):

runner.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def ensure_all_required_settings_are_set(config):
7676
print_error("'retdec_install_dir' in the [runner] section of config_local.ini "
7777
"points to a non-existing directory")
7878
sys.exit(1)
79-
elif not os.path.exists(os.path.join(retdec_install_dir, 'bin', 'retdec-decompiler.py')):
79+
elif not os.path.exists(os.path.join(retdec_install_dir, 'bin', 'retdec-decompiler')):
8080
print_error("'retdec_install_dir' in the [runner] section of config_local.ini "
8181
"does not seem to point to RetDec")
8282
sys.exit(1)
@@ -143,7 +143,7 @@ def adjust_environment(config, args):
143143
if config['runner'].getboolean('idaplugin_tests_enabled'):
144144
tools_dir = os.path.join(config['runner']['retdec_install_dir'], 'bin')
145145

146-
# run-ida-decompilation.py requires retdec-decompiler.py to be reachable from PATH.
146+
# run-ida-decompilation.py requires retdec-decompiler to be reachable from PATH.
147147
os.environ['PATH'] = tools_dir + os.pathsep + os.environ['PATH']
148148

149149
# run-ida-decompilation.py requires path to IDA Pro.
@@ -166,7 +166,7 @@ def adjust_environment(config, args):
166166
if config['runner'].getboolean('r2plugin_tests_enabled'):
167167
tools_dir = os.path.join(config['runner']['retdec_install_dir'], 'bin')
168168

169-
# run-r2-decompilation.py requires retdec-decompiler.py to be reachable from PATH.
169+
# run-r2-decompilation.py requires retdec-decompiler to be reachable from PATH.
170170
os.environ['PATH'] = tools_dir + os.pathsep + os.environ['PATH']
171171

172172
# Copy run-r2-decompilation.py into the directory where other tools

tests/tools/decompiler_runner_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_tool_class_returns_decompilation(self):
3232
def test_get_tool_executable_name_returns_correct_name(self):
3333
self.assertEqual(
3434
self.decomp_runner._get_tool_executable_name('decompiler'),
35-
'retdec-decompiler.py'
35+
'retdec-decompiler'
3636
)
3737

3838
def test_initialize_tool_dir_and_args_just_returns_args_when_config_file_is_not_set(self):

0 commit comments

Comments
 (0)