[PATCH] D86625: [unittests/Object] - Add testing for missing ELF formats.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 00:15:47 PDT 2020
jhenderson 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);
+}
----------------
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.
================
Comment at: llvm/unittests/Object/ELFObjectFileTest.cpp:86-87
TEST(ELFObjectFileTest, MachineTestForVE) {
checkFormatAndArch({ELF::ELFCLASS64, ELF::ELFDATA2LSB, ELF::EM_VE},
"elf64-ve", Triple::ve);
}
----------------
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".
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86625/new/
https://reviews.llvm.org/D86625
More information about the llvm-commits
mailing list