[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 21:39:45 UTC 2023



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


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

- - - - -
41f978e4 by Owen Shepherd at 2023-12-02T16:39:30-05:00
docs(NonEmpty/group): Remove cycle from group haddock example

- - - - -
2a6d6830 by Owen Shepherd at 2023-12-02T16:39:30-05:00
docs(NonEmpty/group): Use repl haddock syntax in group docs

- - - - -
346efb15 by Owen Shepherd at 2023-12-02T16:39:31-05:00
docs(NonEmpty/group): Use list [] notation in group haddock

- - - - -
defd677b by Owen Shepherd at 2023-12-02T16:39:31-05:00
docs(NonEmpty/group): Specify final property of group function in haddock

- - - - -
8c3b9b4f by Owen Shepherd at 2023-12-02T16:39:31-05:00
fix: Add missing property of List.group

- - - - -
2cbe5caa by Matthew Pickering at 2023-12-02T16:39:31-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.

- - - - -
53005d6d by Matthew Pickering at 2023-12-02T16:39:31-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

- - - - -
6903c728 by Matthew Pickering at 2023-12-02T16:39:31-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/cfc1f74372a253f67124c27ca2d65605e39722fd...6903c7280c3e0a87f890a9d3d9e28769e8df5170

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cfc1f74372a253f67124c27ca2d65605e39722fd...6903c7280c3e0a87f890a9d3d9e28769e8df5170
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/7055807a/attachment-0001.html>


More information about the ghc-commits mailing list