[libcxx-commits] [PATCH] D116958: [libc++] Alphabetize CMakeLists.txt and module.modulemap; enforce in CI.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 10 12:21:50 PST 2022


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

I would like to suggest a different approach, which would make sure that these tests are executed all the time, not only in the CI. You could create a file like `libcxx/test/libcxx/lint_cmakelist.sh.py` with something like this inside it:

  # RUN: %{python} %s '%{libcxx}'
  
  libcxx = sys.argv[1]
  cmakelist = os.path.join(libcxx, 'include', 'CMakeLists.txt')
  assert os.path.exists(cmakelist)
  with open(cmakelist, 'r') as f:
      lines = f.readlines()
  assert lines[0] == 'set(files\n'
  
  okay = True
  prevline = lines[1]
  for line in lines[2:]:
      if (line == '  )\n'):
          break
      if (line < prevline):
          okay = False
          print('LINES OUT OF ORDER in libcxx/include/CMakeLists.txt!')
          print(prevline)
          print(line)
      prevline = line
  assert okay

Then, this would be executed whenever we run the tests. That would require moving the `%{python}`-related logic in `libcxx/test/libcxx/selftest/dsl/lit.local.cfg` to `libcxx/test/libcxx`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116958/new/

https://reviews.llvm.org/D116958



More information about the libcxx-commits mailing list