Commit d334ce0b authored by Greg Clayton's avatar Greg Clayton
Browse files

Fix GSYM tests to run the yaml files and fix test failures on some machines.

Summary: YAML files were not being run during lit testing as there was no lit.local.cfg file. Once this was fixed, some buildbots would fail due to a StringRef that pointed to a std::string inside of a temporary llvm::Triple object. These issues are fixed here by making a local triple object that stays around long enough so the StringRef points to valid data.

Reviewers: aprantl, thakis, MaskRay, aadsm, wallace

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75390
parent 9fcd212e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
config.suffixes = ['.test', '.yaml']
+6 −3
Original line number Diff line number Diff line
@@ -179,7 +179,8 @@ static bool filterArch(MachOObjectFile &Obj) {
  if (ArchFilters.empty())
    return true;

  StringRef ObjArch = Obj.getArchTriple().getArchName();
  Triple ObjTriple(Obj.getArchTriple());
  StringRef ObjArch = ObjTriple.getArchName();

  for (auto Arch : ArchFilters) {
    // Match name.
@@ -350,7 +351,8 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
  error(Filename, errorToErrorCode(BinOrErr.takeError()));

  if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get())) {
    auto ArchName = Obj->makeTriple().getArchName();
    Triple ObjTriple(Obj->makeTriple());
    auto ArchName = ObjTriple.getArchName();
    outs() << "Output file (" << ArchName << "): " << OutFile << "\n";
    if (auto Err = handleObjectFile(*Obj, OutFile.c_str()))
      return Err;
@@ -374,7 +376,8 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,

    // Now handle each architecture we need to convert.
    for (auto &Obj: FilterObjs) {
      auto ArchName = Obj->getArchTriple().getArchName();
      Triple ObjTriple(Obj->getArchTriple());
      auto ArchName = ObjTriple.getArchName();
      std::string ArchOutFile(OutFile);
      // If we are only handling a single architecture, then we will use the
      // normal output file. If we are handling multiple architectures append