Use test-specific module caches to avoid stale header conflicts

Stale global module caches cause problems for the bots. The modules
become invalid when clang headers are updated by version control, and
tests which use these modules fail to compile, e.g:

  fatal error: file '.../__stddef_max_align_t.h' has been modified since the module file '/var/.../Darwin.pcm' was built
  note: please rebuild precompiled header '/var/.../Darwin.pcm'

Eventually we should transition to having just a single module cache to speed
tests up. This patch should be just enough to fix the spurious bot failures due
to stale caches.

rdar://36479805, also related to llvm.org/PR36048

Differential Revision: https://reviews.llvm.org/D42277

llvm-svn: 323450
This commit is contained in:
Vedant Kumar 2018-01-25 18:01:27 +00:00
parent db9dd5b43e
commit 801362f067
11 changed files with 22 additions and 11 deletions

View File

@ -26,6 +26,8 @@ class CppDataFormatterTestCase(TestBase):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24462: Data formatters have problems on Windows")
@skipIf(debug_info="gmodules",
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()

View File

@ -9,6 +9,7 @@ import os
import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
@ -22,6 +23,8 @@ class GlobalsDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIf(debug_info="gmodules",
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()

View File

@ -31,6 +31,8 @@ class LibcxxListDataFormatterTestCase(TestBase):
'// Set fourth break point at this line.')
@add_test_categories(["libc++"])
@skipIf(debug_info="gmodules",
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()

View File

@ -18,6 +18,8 @@ class LibcxxVectorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
@skipIf(debug_info="gmodules",
bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()

View File

@ -1,6 +1,6 @@
LEVEL = ../../../make
OBJC_SOURCES := main.m
CFLAGS += -fmodules -gmodules -g
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
include $(LEVEL)/Makefile.rules

View File

@ -26,7 +26,7 @@ class ObjCModulesAutoImportTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipUnlessDarwin
@skipIf(macos_version=["<", "10.12"])
@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
def test_expr(self):
self.build()
exe = self.getBuildArtifact("a.out")

View File

@ -4,5 +4,5 @@ OBJC_SOURCES := main.m myModule.m
include $(LEVEL)/Makefile.rules
CFLAGS += -fmodules -I$(PWD)
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
LDFLAGS += -framework Foundation

View File

@ -24,7 +24,7 @@ class IncompleteModulesTestCase(TestBase):
@skipUnlessDarwin
@unittest2.expectedFailure("rdar://20416388")
@skipIf(macos_version=["<", "10.12"])
@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
def test_expr(self):
self.build()
exe = self.getBuildArtifact("a.out")

View File

@ -6,4 +6,4 @@ OBJC_SOURCES := main.m
include $(LEVEL)/Makefile.rules
CFLAGS += -fmodules -I$(PWD)
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)

View File

@ -27,7 +27,7 @@ class ModulesInlineFunctionsTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint here.')
@skipUnlessDarwin
@skipIf(macos_version=["<", "10.12"])
@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
def test_expr(self):
self.build()
exe = self.getBuildArtifact("a.out")

View File

@ -237,13 +237,15 @@ ifeq "$(MAKE_DWO)" "YES"
CFLAGS += -gsplit-dwarf
endif
CLANG_MODULE_CACHE_DIR := module-cache
MANDATORY_MODULE_BUILD_CFLAGS := -fmodules -gmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
ifeq "$(MAKE_GMODULES)" "YES"
CFLAGS += -fmodules -gmodules
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
endif
CXXFLAGS += -std=c++11
# FIXME: C++ modules aren't supported on all platforms.
CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
CXXFLAGS += -std=c++11 $(CFLAGS)
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
@ -636,7 +638,7 @@ endif
dsym: $(DSYM)
all: $(EXE) $(DSYM)
clean::
$(RM) $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
$(RM) -rf $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(CLANG_MODULE_CACHE_DIR)
ifneq "$(DYLIB_NAME)" ""
$(RM) -r $(DYLIB_FILENAME).dSYM
$(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug