[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 9 commits: docs(NonEmpty/group): Remove incorrect haddock link quotes in code block

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Dec 2 17:39:21 UTC 2023



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


Commits:
f43a86f6 by Owen Shepherd at 2023-12-02T12:39:07-05:00
docs(NonEmpty/group): Remove incorrect haddock link quotes in code block

- - - - -
294ef771 by Owen Shepherd at 2023-12-02T12:39:07-05:00
docs(NonEmpty/group): Remove cycle from group haddock example

- - - - -
4852a997 by Owen Shepherd at 2023-12-02T12:39:07-05:00
docs(NonEmpty/group): Use repl haddock syntax in group docs

- - - - -
fbc2c49f by Owen Shepherd at 2023-12-02T12:39:08-05:00
docs(NonEmpty/group): Use list [] notation in group haddock

- - - - -
6407d04c by Owen Shepherd at 2023-12-02T12:39:08-05:00
docs(NonEmpty/group): Specify final property of group function in haddock

- - - - -
f42f3016 by Owen Shepherd at 2023-12-02T12:39:08-05:00
fix: Add missing property of List.group

- - - - -
94029539 by Matthew Pickering at 2023-12-02T12:39:08-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.

- - - - -
12edd0de by Matthew Pickering at 2023-12-02T12:39:08-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

- - - - -
cfc1f743 by Matthew Pickering at 2023-12-02T12:39:08-05:00
testsuite: Remove rogue trace in testsuite

I accidentally left a trace in the generics metric patch.

- - - - -


7 changed files:

- libraries/base/src/Data/List/NonEmpty.hs
- libraries/base/src/Data/OldList.hs
- 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:

=====================================
libraries/base/src/Data/List/NonEmpty.hs
=====================================
@@ -398,10 +398,12 @@ partition p = List.partition p . toList
 -- | The 'group' function takes a stream and returns a list of
 -- streams such that flattening the resulting list is equal to the
 -- argument.  Moreover, each stream in the resulting list
--- contains only equal elements.  For example, in list notation:
+-- contains only equal elements, and consecutive equal elements
+-- of the input end up in the same stream of the output list.
+-- For example, in list notation:
 --
--- > 'group' $ 'cycle' "Mississippi"
--- >   = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...
+-- >>> group "Mississippi"
+-- ["M", "i", "ss", "i", "ss", "i", "pp", "i"]
 group :: (Foldable f, Eq a) => f a -> [NonEmpty a]
 group = groupBy (==)
 


=====================================
libraries/base/src/Data/OldList.hs
=====================================
@@ -1360,8 +1360,9 @@ deleteFirstsBy eq       =  foldl (flip (deleteBy eq))
 
 -- | The 'group' function takes a list and returns a list of lists such
 -- that the concatenation of the result is equal to the argument.  Moreover,
--- each sublist in the result is non-empty and all elements are equal
--- to the first one.
+-- each sublist in the result is non-empty, all elements are equal to the
+-- first one, and consecutive equal elements of the input end up in the
+-- same element of the output list.
 --
 -- 'group' is a special case of 'groupBy', which allows the programmer to supply
 -- their own equality test.


=====================================
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/3e20f9383ed1cac3f8ccd4869164e765ab8fb4fb...cfc1f74372a253f67124c27ca2d65605e39722fd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3e20f9383ed1cac3f8ccd4869164e765ab8fb4fb...cfc1f74372a253f67124c27ca2d65605e39722fd
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/20231202/c8ec9e8d/attachment-0001.html>


More information about the ghc-commits mailing list