[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: testsuite: Fix T21097b test with make 4.1 (deb9)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Dec 1 20:16:03 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
f1e1f0f2 by Matthew Pickering at 2023-12-01T15:15:54-05:00
testsuite: Fix T21097b test with make 4.1 (deb9)

cee81370cd6ef256f66035e3116878d4cb82e28b recently added a test which
failed on deb9 because the version of make was emitting the recipe
failure to stdout rather than stderr.

One way to fix this is to be more precise in the test about which part
of the output we care about inspecting.

- - - - -
d0aaf0af by Matthew Pickering at 2023-12-01T15:15:55-05:00
testsuite: Track size of libdir in bytes

For consistency it's better if we track all size metrics in bytes.

Metric Increase:
  libdir

- - - - -
5504f77c by Matthew Pickering at 2023-12-01T15:15:55-05:00
testsuite: Remove rogue trace in testsuite

I accidentally left a trace in the generics metric patch.

- - - - -


5 changed files:

- testsuite/driver/testlib.py
- testsuite/tests/driver/T21097b/T21097b.stdout
- testsuite/tests/driver/T21097b/all.T
- − testsuite/tests/perf/size/Makefile
- testsuite/tests/perf/size/all.T


Changes:

=====================================
testsuite/driver/testlib.py
=====================================
@@ -607,6 +607,19 @@ def _extra_files(name, opts, files):
 def collect_size ( deviation, path ):
     return collect_generic_stat ( 'size', deviation, lambda way: os.path.getsize(in_testdir(path)) )
 
+def get_dir_size(path):
+    total = 0
+    with os.scandir(path) as it:
+        for entry in it:
+            if entry.is_file():
+                total += entry.stat().st_size
+            elif entry.is_dir():
+                total += get_dir_size(entry.path)
+    return total
+
+def collect_size_dir ( deviation, path ):
+    return collect_generic_stat ( 'size', deviation, lambda way: get_dir_size(path) )
+
 # Read a number from a specific file
 def stat_from_file ( metric, deviation, path ):
     def read_file (way):
@@ -1810,7 +1823,6 @@ def metric_dict(name, way, metric, value) -> PerfStat:
 def check_generic_stats(name, way, get_stats):
     for (metric, gen_stat) in get_stats.items():
         res = report_stats(name, way, metric, gen_stat)
-        print(res)
         if badResult(res):
             return res
     return passed()


=====================================
testsuite/tests/driver/T21097b/T21097b.stdout
=====================================
@@ -1,5 +1 @@
-
-==================== Module Map ====================
 Foo                                               a-0.1 (exposed package)
-
-


=====================================
testsuite/tests/driver/T21097b/all.T
=====================================
@@ -1,6 +1,15 @@
+def normalise_t21097b_output(s):
+  res = ""
+  for l in s.splitlines():
+    if 'Foo' in l:
+      res += l
+      res += "\n"
+  return res
+
 # Package b is unusable (broken dependency) and reexport Foo from a (which is usable)
 test('T21097b',
   [ extra_files(["pkgdb", "pkgdb/a.conf", "pkgdb/b.conf", "Test.hs"])
   , ignore_stderr
+  , normalise_fun(normalise_t21097b_output)
   , exit_code(2)
   ], makefile_test, [])


=====================================
testsuite/tests/perf/size/Makefile deleted
=====================================
@@ -1,7 +0,0 @@
-TOP=../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/test.mk
-
-libdir_size:
-	du -s `$(TEST_HC) --print-libdir` | cut -f1 > SIZE
-


=====================================
testsuite/tests/perf/size/all.T
=====================================
@@ -1,3 +1,3 @@
 test('size_hello_obj', [collect_size(5, 'size_hello_obj.o')], compile, [''])
 
-test('libdir',[stat_from_file('size', 10, 'SIZE')], makefile_test, ['libdir_size'] )
+test('libdir',[collect_size_dir(10, config.libdir)], static_stats, [] )



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97d04881488fc3b2c35f3393151bd11f7750ca7f...5504f77c7fe3633190c045e4816d9afc13e4882d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97d04881488fc3b2c35f3393151bd11f7750ca7f...5504f77c7fe3633190c045e4816d9afc13e4882d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231201/ff7470c4/attachment-0001.html>


More information about the ghc-commits mailing list