[Git][ghc/ghc][master] 2 commits: testsuite: Track size of libdir in bytes

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sun Dec 3 05:12:13 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
5efdf421 by Matthew Pickering at 2023-12-03T00:11:21-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

- - - - -
f5eb0f29 by Matthew Pickering at 2023-12-03T00:11:22-05:00
testsuite: Remove rogue trace in testsuite

I accidentally left a trace in the generics metric patch.

- - - - -


3 changed files:

- testsuite/driver/testlib.py
- − 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/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/bad3765668cc5badf5d0a19100fac95125985473...f5eb0f2982e9cf27515e892c4bdf634bcfb28459

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bad3765668cc5badf5d0a19100fac95125985473...f5eb0f2982e9cf27515e892c4bdf634bcfb28459
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/20231203/80bf06d1/attachment-0001.html>


More information about the ghc-commits mailing list