Skip to content

Commit d5711c7

Browse files
committed
remove secondary parser
1 parent 10447c8 commit d5711c7

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function(discover_specs spec_folder)
8383
cmake_path(GET spec PARENT_PATH spec_folder)
8484

8585
if (${output_junit})
86+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/results/${spec_folder})
8687
add_spec(${spec} "--output-junit;${CMAKE_CURRENT_BINARY_DIR}/results/${spec_folder}/${spec_name}.xml")
8788
else()
8889
add_spec(${spec} "")

include/argparse.hpp

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
#pragma once
22

3-
#include <string>
4-
#include <string_view>
5-
6-
#ifdef CPPSPEC_SEMIHOSTED
7-
#include <sys/stat.h>
8-
#include <cstring>
9-
#else
103
#include <argparse/argparse.hpp>
11-
#include <filesystem>
124
#include <fstream>
13-
#endif
14-
5+
#include <string>
6+
#include <string_view>
157
#include "formatters/junit_xml.hpp"
168
#include "formatters/progress.hpp"
179
#include "formatters/tap.hpp"
@@ -31,31 +23,6 @@ inline std::string file_name(std::string_view path) {
3123
}
3224

3325
inline Runner parse(int argc, char** const argv) {
34-
#ifdef CPPSPEC_SEMIHOSTED
35-
int i = 0;
36-
for (; i < argc; ++i) {
37-
if (strcmp(argv[i], "-f") == 0) {
38-
break;
39-
}
40-
}
41-
if (i == argc) {
42-
return Runner{std::make_shared<Formatters::Progress>()};
43-
std::exit(-1);
44-
}
45-
std::string format_string = argv[i + 1];
46-
if (format_string == "d" || format_string == "detail") {
47-
return Runner{std::make_shared<Formatters::Verbose>()};
48-
} else if (format_string == "p" || format_string == "progress") {
49-
return Runner{std::make_shared<Formatters::Progress>()};
50-
} else if (format_string == "t" || format_string == "tap") {
51-
return Runner{std::make_shared<Formatters::TAP>()};
52-
} else if (format_string == "j" || format_string == "junit") {
53-
return Runner{std::make_shared<Formatters::JUnitXML>()};
54-
} else {
55-
std::cerr << "Unrecognized format type" << std::endl;
56-
std::exit(-1);
57-
}
58-
#else
5926
std::filesystem::path executable_path = argv[0];
6027
std::string executable_name = executable_path.filename().string();
6128
argparse::ArgumentParser program{executable_name};
@@ -94,16 +61,11 @@ inline Runner parse(int argc, char** const argv) {
9461

9562
auto junit_output_filepath = program.get<std::string>("--output-junit");
9663
if (!junit_output_filepath.empty()) {
97-
// create directories recursively if they don't exist
98-
std::filesystem::path junit_output_path = junit_output_filepath;
99-
std::filesystem::create_directories(junit_output_path.parent_path());
100-
10164
// open file stream
10265
auto* file_stream = new std::ofstream(junit_output_filepath);
10366
auto junit_output = std::make_shared<Formatters::JUnitXML>(*file_stream, false);
10467
return Runner{formatter, junit_output};
10568
}
10669
return Runner{formatter};
107-
#endif
10870
}
10971
} // namespace CppSpec

0 commit comments

Comments
 (0)