summaryrefslogtreecommitdiff
path: root/utils/yaml-bench
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-05-07 18:08:46 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-05-07 18:08:46 +0000
commit9e31c0cf91532c1e39055d2b6352f196959a2a13 (patch)
treefb6f0505b0266b35e54a8a4db7f862ee960f612c /utils/yaml-bench
parentad80c2d9ed1a348deaacdf11aa17c40382a97ac7 (diff)
YAML: Enable the YAMLParser tests.
This commit enables the tests located in test/YAMLParser directory. Those tests were never actually enabled, as llvm-lit didn't pick up the files with the 'data' extension. The commit renames those test files to files with the 'test' extension so that llvm-lit would find them. This commit also modifies yaml-bench so that it returns an error status if an error occurred during parsing. It also adds the '-use-color' command line option to yaml-bench (to make sure that file check matches the error messages in the output stream). This commit modifies some of the renamed tests so that they wouldn't fail. It gets rid of XFAILs and uses the 'not' command instead for some of the tests that have to fail during parsing. This commit also adds some 'FIXME' comments to a couple of tests that are supposed to fail but currently pass because of various bugs in the implementation of the yaml parser. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9448 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/yaml-bench')
-rw-r--r--utils/yaml-bench/YAMLBench.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/yaml-bench/YAMLBench.cpp b/utils/yaml-bench/YAMLBench.cpp
index 0fb31387fc2..bd5aa152dff 100644
--- a/utils/yaml-bench/YAMLBench.cpp
+++ b/utils/yaml-bench/YAMLBench.cpp
@@ -19,6 +19,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/Timer.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
@@ -52,6 +53,10 @@ static cl::opt<unsigned>
"Do not use more megabytes of memory"),
cl::init(1000));
+cl::opt<cl::boolOrDefault>
+ UseColor("use-color", cl::desc("Emit colored output (default=autodetect)"),
+ cl::init(cl::BOU_UNSET));
+
struct indent {
unsigned distance;
indent(unsigned d) : distance(d) {}
@@ -187,6 +192,9 @@ static std::string createJSONText(size_t MemoryMB, unsigned ValueSize) {
int main(int argc, char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv);
+ bool ShowColors = UseColor == cl::BOU_UNSET
+ ? sys::Process::StandardOutHasColors()
+ : UseColor == cl::BOU_TRUE;
if (Input.getNumOccurrences()) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
MemoryBuffer::getFileOrSTDIN(Input);
@@ -200,8 +208,10 @@ int main(int argc, char **argv) {
}
if (DumpCanonical) {
- yaml::Stream stream(Buf.getBuffer(), sm);
+ yaml::Stream stream(Buf.getBuffer(), sm, ShowColors);
dumpStream(stream);
+ if (stream.failed())
+ return 1;
}
}