[PATCH] D75343: [RFC][debuginfo-tests][dexter] Add a test generation tool

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 08:55:32 PST 2020


Pierre-vh marked 2 inline comments as done.
Pierre-vh added inline comments.


================
Comment at: debuginfo-tests/dexter/dex/debugger/Debuggers.py:166
+    else:
+        step_collection.commands = OrderedDict()
 
----------------
TWeaver wrote:
> I understand this is at the prototype stage, but... 😉 
> 
> This extra else step here I believe is to setup an empty dict that can be filled with commands generated by the test run for the annotated test file generation (correct me if I'm wrong).
> 
> I'm not completely against having an else statement here but I feel there should at least be a comment describing why we'd want differing behaviour.
> 
> Also, whilst I'm not a huge fan of the 'big-ball-of-context' approach taken in the past, we could reduce the parameter list to get_debugger_steps by interrogating the context object.
These are really good suggestions, thank you

The else statement is needed because it crashes without it
```
Traceback (most recent call last):
  File "/llvm-project/debuginfo-tests/dexter/dex/../dexter.py", line 15, in <module>
    return_code = main()
  File "/llvm-project/debuginfo-tests/dexter/dex/tools/Main.py", line 193, in main
    return tool_main(context, module.Tool(context), args)
  File "/llvm-project/debuginfo-tests/dexter/dex/tools/Main.py", line 162, in tool_main
    return_code = tool.go()
  File "/llvm-project/debuginfo-tests/dexter/dex/tools/run_debugger_internal_/Tool.py", line 68, in go
    debugger.start()
  File "/llvm-project/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py", line 125, in start
    for command_obj in chain.from_iterable(self.steps.commands.values()):
AttributeError: 'NoneType' object has no attribute 'values'

```

I'll try to find a better solution to this problem, and if I can't find one, I'll just add a comment explaining why this `else` is there


================
Comment at: debuginfo-tests/dexter/dex/tools/gen/Tool.py:103
+            nargs='?',
+            help='directory in which the generation tool will run')
+        parser.add_argument(
----------------
TWeaver wrote:
> does this mean the generation tool runs inside the same directory the test is within?
> 
> if so, where does it store the newly generated/annotated test file?
> 
> thanks
> Tom W
Currently, it runs in the test directory and writes the command directly to the test source
So, in order to use this tool, you need to create a folder, put your `.cpp` file inside it alongside a `test.cfg`, like you would do for a normal test

I know this isn't ideal, but I did that because it allowed me to re-use most of the existing logic (because this is a prototype). 
A final version should probably work on the .cpp directly and have options to write the commands to another file/stdout/whatever.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75343/new/

https://reviews.llvm.org/D75343





More information about the llvm-commits mailing list