summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-01-31 19:08:01 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-04 10:02:35 -0500
commit62d670eb3a1c059f1ff977471f8d77dac5cf21b8 (patch)
treecf1406720690eba63cc3ad2d92385dc8689ad1d5 /utils
parenteddaa591a478e7598a9f5df4c26306e4fadbf08e (diff)
downloadhaskell-62d670eb3a1c059f1ff977471f8d77dac5cf21b8.tar.gz
testsuite: Run testsuite dependency calculation before GHC is built
The main motivation for this patch is to allow tests to be added to the testsuite which test things about the source tree without needing to build GHC. In particular the notes linter can easily start failing and by integrating it into the testsuite the process of observing these changes is caught by normal validation procedures rather than having to run the linter specially. With this patch I can run ``` ./hadrian/build test --flavour=devel2 --only="uniques" ``` In a clean tree to run the checkUniques linter without having to build GHC. Fixes #21029
Diffstat (limited to 'utils')
-rw-r--r--utils/checkUniques/Makefile8
-rwxr-xr-xutils/checkUniques/check-uniques.py49
2 files changed, 0 insertions, 57 deletions
diff --git a/utils/checkUniques/Makefile b/utils/checkUniques/Makefile
deleted file mode 100644
index b53759c734..0000000000
--- a/utils/checkUniques/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-TOP = ../..
-
-GHC = ghc
-
-.PHONY: check
-
-check:
- ./check-uniques.py $(TOP)
diff --git a/utils/checkUniques/check-uniques.py b/utils/checkUniques/check-uniques.py
deleted file mode 100755
index dd5891b0d8..0000000000
--- a/utils/checkUniques/check-uniques.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-
-import os.path
-import sys
-import re
-import glob
-import io
-from collections import defaultdict
-
-# keyed on unique type, values are lists of (unique, name) pairs
-def find_uniques(source_files):
- uniques = defaultdict(lambda: defaultdict(lambda: set()))
- unique_re = re.compile(r"([\w\d]+)\s*=\s*mk([\w\d']+)Unique\s+(\d+)")
- for f in source_files:
- ms = unique_re.findall(io.open(f, encoding='utf8').read())
- for name, _type, n in ms:
- uniques[_type][int(n)].add(name)
-
- return uniques
-
-def print_all(uniques):
- for _type, uniqs in uniques.items():
- print('{_type} uniques'.format(**locals()))
- for n,names in uniqs.items():
- all_names = ', '.join(names)
- print(' {n} = {all_names}'.format(**locals()))
-
-def find_conflicts(uniques):
- return [ (uniqueType, number, names)
- for uniqueType, uniqs in uniques.items()
- for number, names in uniqs.items()
- if len(names) > 1
- ]
-
-top_dir = sys.argv[1]
-uniques = find_uniques(glob.glob(os.path.join(top_dir, 'compiler', 'GHC', '**', '*.hs'), recursive=True))
-#print_all(uniques)
-conflicts = find_conflicts(uniques)
-if len(uniques) < 5:
- print("Error: check-uniques: run from wrong directory?")
- sys.exit(1)
-
-if len(conflicts) > 0:
- print("Error: check-uniques: Found Unique conflict")
- print()
- for (ty, n, names) in conflicts:
- print(' %s unique %d conflict: %s' % (ty, n, ', '.join(names)))
- print()
- sys.exit(1)