[PATCH] D140291: [llvm-objcopy] Use getNumberOfSymbols() instead of getRawNumberOfSymbols()

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 04:06:10 PST 2022


mstorsjo added a comment.

Thanks for the update - this mostly looks good to me. Using python to overwrite parts of the object file looks neat! Unfortunately, it seems to have failed in the Windows pre-merge tests. The output from that seems to be this:

  FAIL: LLVM :: tools/llvm-objcopy/COFF/no-symbol-table.test (43164 of 45770)
  ******************** TEST 'LLVM :: tools/llvm-objcopy/COFF/no-symbol-table.test' FAILED ********************
  Script:
  --
  : 'RUN: at line 4';   c:\ws\w3\llvm-project\premerge-checks\build\bin\yaml2obj.exe C:\ws\w3\llvm-project\premerge-checks\llvm\test\tools\llvm-objcopy\COFF/Inputs/no-symbol-table.yaml -o C:\ws\w3\llvm-project\premerge-checks\build\test\tools\llvm-objcopy\COFF\Output\no-symbol-table.test.tmp.obj
  : 'RUN: at line 7';   "C:\Python39\python.exe" -c "with open('C:\ws\w3\llvm-project\premerge-checks\build\test\tools\llvm-objcopy\COFF\Output\no-symbol-table.test.tmp.obj', 'r+b') as input: input.seek(8); input.write(b'\x00' * 4)"
  : 'RUN: at line 9';   c:\ws\w3\llvm-project\premerge-checks\build\bin\llvm-objcopy.exe C:\ws\w3\llvm-project\premerge-checks\build\test\tools\llvm-objcopy\COFF\Output\no-symbol-table.test.tmp.obj
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  $ ":" "RUN: at line 4"
  $ "c:\ws\w3\llvm-project\premerge-checks\build\bin\yaml2obj.exe" "C:\ws\w3\llvm-project\premerge-checks\llvm\test\tools\llvm-objcopy\COFF/Inputs/no-symbol-table.yaml" "-o" "C:\ws\w3\llvm-project\premerge-checks\build\test\tools\llvm-objcopy\COFF\Output\no-symbol-table.test.tmp.obj"
  $ ":" "RUN: at line 7"
  $ "C:\Python39\python.exe" "-c" "with open('C:\ws\w3\llvm-project\premerge-checks\build\test\tools\llvm-objcopy\COFF\Output\no-symbol-table.test.tmp.obj', 'r+b') as input: input.seek(8); input.write(b'\x00' * 4)"
  # command stderr:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  OSError: [Errno 22] Invalid argument: 'C:\\ws\\w3\\llvm-project\\premerge-checks\x08uild\test\tools\\llvm-objcopy\\COFF\\Output\no-symbol-table.test.tmp.obj'
  
  error: command failed with exit status: 1
  
  --
  
  ********************

A common comment on testcases like this, is that it's bit odd to have a test that only runs a command but doesn't have any actual checks afterwards. Maybe a simple check to see that the output has zero symbols would add some more functional aspect to the test too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140291



More information about the llvm-commits mailing list