Merge pull request #5197 from AlexOfTheForest/test/relinker-cli-module-and-target-options
test(cli): cover module-dir, sce-module-path and target option errors
This commit is contained in:
commit
aa1927872f
|
|
@ -224,6 +224,41 @@ void windowsFixedBase() {
|
|||
|
||||
}
|
||||
|
||||
void moduleDirectories() {
|
||||
const auto args = parse({"--module-dir", "Media/Plugins", "input.elf", "--module-dir", "extra", "output.elf"});
|
||||
require(args.moduleDirectories == std::vector<std::string>{"Media/Plugins", "extra"}, "--module-dir directories were not recorded in order");
|
||||
require(args.inputPath == "input.elf" && args.outputPath == "output.elf", "--module-dir consumed a positional path");
|
||||
expectThrows({"--module-dir"}, "--module-dir requires a directory");
|
||||
expectThrows({"--skip-sce-module", "--module-dir", "Media/Plugins", "input.elf", "output.elf"}, "--module-dir conflicts with --skip-sce-module");
|
||||
expectThrows({"--module-dir", "Media/Plugins", "--skip-sce-module", "input.elf", "output.elf"}, "--module-dir conflicts with --skip-sce-module");
|
||||
}
|
||||
|
||||
void sceModulePath() {
|
||||
const auto args = parse({"--sce-module-path", "modules", "input.elf", "output.elf"});
|
||||
require(args.sceModulePath == "modules", "--sce-module-path value was not captured");
|
||||
expectThrows({"--sce-module-path"}, "--sce-module-path requires a nonempty path");
|
||||
expectThrows({"--sce-module-path", "", "input.elf", "output.elf"}, "--sce-module-path requires a nonempty path");
|
||||
expectThrows({"--sce-module-path", "--registry", "input.elf", "output.elf"}, "--sce-module-path requires a nonempty path");
|
||||
expectThrows({"--sce-module-path", "a", "--sce-module-path", "b", "input.elf", "output.elf"}, "--sce-module-path must be specified once");
|
||||
expectThrows({"--skip-sce-module", "--sce-module-path", "modules", "input.elf", "output.elf"}, "--sce-module-path conflicts with --skip-sce-module");
|
||||
expectThrows({"--sce-module-path", "modules", "--skip-sce-module", "input.elf", "output.elf"}, "--sce-module-path conflicts with --skip-sce-module");
|
||||
}
|
||||
|
||||
void targetSelection() {
|
||||
const auto macos = parse({"--macos", "input.elf", "output.elf"});
|
||||
require(macos.toMacos && !macos.toWindows, "--macos did not select only the macOS target");
|
||||
const auto rosetta = parse({"--to-rosetta", "input.elf", "output.elf"});
|
||||
require(rosetta.toRosetta && rosetta.toIntel, "--to-rosetta did not imply --to-intel");
|
||||
const auto rosettaOnMacos = parse({"--macos", "--to-rosetta", "input.elf", "output.elf"});
|
||||
require(rosettaOnMacos.toMacos && rosettaOnMacos.toRosetta && rosettaOnMacos.toIntel, "--to-rosetta was rejected with --macos");
|
||||
const std::string targetConflict = "--windows conflicts with --macos";
|
||||
expectThrows({"--windows", "--macos", "input.elf", "output.elf"}, targetConflict);
|
||||
expectThrows({"--macos", "--windows", "input.elf", "output.elf"}, targetConflict);
|
||||
const std::string rosettaConflict = "--to-rosetta conflicts with --windows";
|
||||
expectThrows({"--windows", "--to-rosetta", "input.elf", "output.elf"}, rosettaConflict);
|
||||
expectThrows({"--to-rosetta", "--windows", "input.elf", "output.elf"}, rosettaConflict);
|
||||
}
|
||||
|
||||
int main() {
|
||||
try {
|
||||
defaults();
|
||||
|
|
@ -238,6 +273,9 @@ int main() {
|
|||
excludeSceModuleConsumesNextTokenVerbatim();
|
||||
excludeSceModuleWithoutValue();
|
||||
excludeConflictsWithSkip();
|
||||
moduleDirectories();
|
||||
sceModulePath();
|
||||
targetSelection();
|
||||
executables();
|
||||
unusedFilter();
|
||||
unusedFilterRejectsBadValues();
|
||||
|
|
|
|||
Loading…
Reference in New Issue