[lldb][Test] Propagate llvm::yaml error message in TestFile::fromYaml
authorMichael Buch <michaelbuch12@gmail.com>
Thu, 15 Dec 2022 16:26:20 +0000 (16:26 +0000)
committerMichael Buch <michaelbuch12@gmail.com>
Thu, 15 Dec 2022 22:45:46 +0000 (22:45 +0000)
commitc46587bb83232bd639c1e6ba6bce2f290941675d
tree6a238d7b30cb8faffaed0fc5b9e1a538bd2861e6
parenta1b4e13cff2a792571927ee1fc6eebb05e40fae9
[lldb][Test] Propagate llvm::yaml error message in TestFile::fromYaml

Currently the test-suite would swallow the error message
on `llvm::yaml::convertYAML` failures.

This patch simply propagates the error string up to the caller.

Before patch:
```
[ RUN      ] DWARFASTParserClangTests.TestDefaultTemplateParamParsing
/Users/michaelbuch/Git/llvm-worktrees/playground/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp:19: Failure
Value of: llvm::detail::TakeExpected(File)
Expected: succeeded
  Actual: failed  (convertYAML() failed: )
Assertion failed: (!HasError && "Cannot get value when an error exists!"), function getStorage, file Error.h, line 671.
```

After patch:
```
[ RUN      ] DWARFASTParserClangTests.TestDefaultTemplateParamParsing
/Users/michaelbuch/Git/llvm-worktrees/playground/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp:19: Failure
Value of: llvm::detail::TakeExpected(File)
Expected: succeeded
  Actual: failed  (convertYAML() failed: wrote too much data somewhere, section offsets don't line up)
Assertion failed: (!HasError && "Cannot get value when an error exists!"), function getStorage, file Error.h, line 671.
```

Differential Revision: https://reviews.llvm.org/D140112
lldb/unittests/TestingSupport/TestUtilities.cpp