[PATCH] D86625: [unittests/Object] - Add testing for missing ELF formats.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 04:35:16 PDT 2020


grimar added inline comments.


================
Comment at: llvm/unittests/Object/ELFObjectFileTest.cpp:77-83
+TEST(ELFObjectFileTest, MachineTestForNone) {
+  checkFormatAndArch({ELF::ELFCLASS64, ELF::ELFDATA2LSB, ELF::EM_NONE},
+                     "elf64-unknown", Triple::UnknownArch);
+
+  checkFormatAndArch({ELF::ELFCLASS32, ELF::ELFDATA2LSB, ELF::EM_NONE},
+                     "elf32-unknown", Triple::UnknownArch);
+}
----------------
jhenderson wrote:
> Maybe it's worth showing that an unused machine value also produces this result? Seems like an easy mistake would be to handle all the known machine types (including EM_NONE) and then put an llvm_unreachable or something at the end which is caught if an undefined value is used.
Reasonable, I think. Done.


================
Comment at: llvm/unittests/Object/ELFObjectFileTest.cpp:86-87
 TEST(ELFObjectFileTest, MachineTestForVE) {
   checkFormatAndArch({ELF::ELFCLASS64, ELF::ELFDATA2LSB, ELF::EM_VE},
                      "elf64-ve", Triple::ve);
 }
----------------
jhenderson wrote:
> Optional, but it might be worth having versions that test the unknown paths for situations like this where one of the classes is unsupported and therefore you get something like "elf32-unknown".
Done.


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

https://reviews.llvm.org/D86625



More information about the llvm-commits mailing list