Skip to content

Commit

Permalink
[libc++] Remove unused functions and minor features of the test suite
Browse files Browse the repository at this point in the history
This commit removes minor features of the test suite that I've never
seen used and that are basically just a maintenance burden:

- color_diagnostics: Diagnostics are colored by default when running
  from a terminal, and not colored otherwise. This is the right behavior.
  Being able to tweak this has minor value, and could be achieved by
  modifying the %{compile_flags} instead if absolutely needed.

- ccache: This can be achieved by using a wrapper for the %{cxx}
  substitution.

- _dump_macros_verbose is just a dead function now.
  • Loading branch information
ldionne committed May 5, 2020
1 parent 6ccaf73 commit 7e6221d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
12 changes: 0 additions & 12 deletions libcxx/docs/TestingLibcxx.rst
Expand Up @@ -188,12 +188,6 @@ default.
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
building libc++ then that sanitizer will be used by default.

.. option:: color_diagnostics

Enable the use of colorized compile diagnostics. If the color_diagnostics
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
present then color diagnostics will be enabled.

.. option:: llvm_unwinder

Enable the use of LLVM unwinder instead of libgcc.
Expand All @@ -211,12 +205,6 @@ Environment Variables
Specify the site configuration to use when running the tests.
Also see `libcxx_site_config`.

.. envvar:: LIBCXX_COLOR_DIAGNOSTICS

If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
to use color diagnostic outputs from the compiler.
Also see `color_diagnostics`.

Writing Tests
-------------

Expand Down
43 changes: 0 additions & 43 deletions libcxx/utils/libcxx/test/config.py
Expand Up @@ -131,11 +131,9 @@ def configure(self):
self.configure_obj_root()
self.configure_cxx_stdlib_under_test()
self.configure_cxx_library_root()
self.configure_ccache()
self.configure_compile_flags()
self.configure_link_flags()
self.configure_env()
self.configure_color_diagnostics()
self.configure_debug_mode()
self.configure_warnings()
self.configure_sanitizer()
Expand Down Expand Up @@ -222,10 +220,6 @@ def configure_cxx(self):
self.cxx = CXXCompiler(self, cxx) if not self.cxx_is_clang_cl else \
self._configure_clang_cl(cxx)
self.cxx.compile_env = dict(os.environ)
# 'CCACHE_CPP2' prevents ccache from stripping comments while
# preprocessing. This is required to prevent stripping of '-verify'
# comments.
self.cxx.compile_env['CCACHE_CPP2'] = '1'

def _configure_clang_cl(self, clang_path):
def _split_env_var(var):
Expand All @@ -245,17 +239,6 @@ def _prefixed_env_list(var, prefix):
compile_flags=compile_flags,
link_flags=link_flags)

def _dump_macros_verbose(self, *args, **kwargs):
macros_or_error = self.cxx.dumpMacros(*args, **kwargs)
if isinstance(macros_or_error, tuple):
cmd, out, err, rc = macros_or_error
report = libcxx.util.makeReport(cmd, out, err, rc)
report += "Compiler failed unexpectedly when dumping macros!"
self.lit_config.fatal(report)
return None
assert isinstance(macros_or_error, dict)
return macros_or_error

def configure_src_root(self):
self.libcxx_src_root = self.get_lit_conf(
'libcxx_src_root', os.path.dirname(self.config.test_source_root))
Expand Down Expand Up @@ -315,13 +298,6 @@ def configure_cxx_stdlib_under_test(self):
if self.get_lit_conf('enable_experimental') is None:
self.config.enable_experimental = 'true'

def configure_ccache(self):
use_ccache_default = os.environ.get('LIBCXX_USE_CCACHE') is not None
use_ccache = self.get_lit_bool('use_ccache', use_ccache_default)
if use_ccache:
self.cxx.use_ccache = True
self.lit_config.note('enabling ccache')

def configure_features(self):
additional_features = self.get_lit_conf('additional_features')
if additional_features:
Expand Down Expand Up @@ -666,25 +642,6 @@ def configure_extra_library_flags(self):
self.cxx.link_flags += ['-lc++external_threads']
self.target_info.add_cxx_link_flags(self.cxx.link_flags)

def configure_color_diagnostics(self):
use_color = self.get_lit_conf('color_diagnostics')
if use_color is None:
use_color = os.environ.get('LIBCXX_COLOR_DIAGNOSTICS')
if use_color is None:
return
if use_color != '':
self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
% use_color)
color_flag = '-fdiagnostics-color=always'
# Check if the compiler supports the color diagnostics flag. Issue a
# warning if it does not since color diagnostics have been requested.
if not self.cxx.hasCompileFlag(color_flag):
self.lit_config.warning(
'color diagnostics have been requested but are not supported '
'by the compiler')
else:
self.cxx.flags += [color_flag]

def configure_debug_mode(self):
debug_level = self.get_lit_conf('debug_level', None)
if not debug_level:
Expand Down

0 comments on commit 7e6221d

Please sign in to comment.