From 99ffcd91217a1100f4d83edbbb57e0de812ccec9 Mon Sep 17 00:00:00 2001 From: perturbing Date: Tue, 26 Aug 2025 16:17:41 +0200 Subject: [PATCH 1/2] fix and expose plutus-benchmark --- .../common/PlutusBenchmark/Common.hs | 32 ++++++++++--------- .../common/PlutusBenchmark/NaturalSort.hs | 2 +- plutus-benchmark/plutus-benchmark.cabal | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/plutus-benchmark/common/PlutusBenchmark/Common.hs b/plutus-benchmark/common/PlutusBenchmark/Common.hs index b03aade8c09..f26f74417b1 100644 --- a/plutus-benchmark/common/PlutusBenchmark/Common.hs +++ b/plutus-benchmark/common/PlutusBenchmark/Common.hs @@ -1,5 +1,6 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE ImportQualifiedPost #-} +{-# LANGUAGE LambdaCase #-} {- | Miscellaneous shared code for benchmarking-related things. -} module PlutusBenchmark.Common @@ -245,16 +246,17 @@ checkGoldenFileExists path = do fullPath <- makeAbsolute path fileExists <- doesFileExist path if not fileExists - then errorWithExplanation $ "golden file " ++ fullPath ++ " does not exist." - else do - perms <- getPermissions path - if not (writable perms) - then errorWithExplanation $ "golden file " ++ fullPath ++ " is not writable." - else pure () - where errorWithExplanation s = - let msg = "\n* ERROR: " ++ s ++ "\n" - ++ "* To ensure that the correct path is used, either use `cabal test` " - ++ "or run the test in the root directory of the relevant package.\n" - ++ "* If this is the first time this test has been run, create an " - ++ "initial golden file manually." - in error msg + then errorWithExplanation $ "golden file " ++ fullPath ++ " does not exist." + else do + perms <- getPermissions path + if not (writable perms) + then errorWithExplanation $ "golden file " ++ fullPath ++ " is not writable." + else pure () + where + errorWithExplanation s = + let msg = "\n* ERROR: " ++ s ++ "\n" + ++ "* To ensure that the correct path is used, either use `cabal test` " + ++ "or run the test in the root directory of the relevant package.\n" + ++ "* If this is the first time this test has been run, create an " + ++ "initial golden file manually." + in error msg diff --git a/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs b/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs index e3bd13a0f23..94c5e5e5ffe 100644 --- a/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs +++ b/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE DerivingStrategies #-} module PlutusBenchmark.NaturalSort (naturalSort) where diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index 7ada0bbb9e5..f0e6e2d8ed5 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -78,6 +78,7 @@ common lang ---------------- Common code for benchmarking ---------------- library plutus-benchmark-common + visibility: public import: lang, os-support hs-source-dirs: common exposed-modules: From 10e15cfc9f7f35c81dfa2290f7cc52bf924b98f3 Mon Sep 17 00:00:00 2001 From: Kenneth MacKenzie Date: Thu, 28 Aug 2025 22:16:00 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Remove unnecessary pragmas. --- plutus-benchmark/common/PlutusBenchmark/Common.hs | 1 - plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs | 1 - 2 files changed, 2 deletions(-) diff --git a/plutus-benchmark/common/PlutusBenchmark/Common.hs b/plutus-benchmark/common/PlutusBenchmark/Common.hs index f26f74417b1..78591158eee 100644 --- a/plutus-benchmark/common/PlutusBenchmark/Common.hs +++ b/plutus-benchmark/common/PlutusBenchmark/Common.hs @@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE LambdaCase #-} {- | Miscellaneous shared code for benchmarking-related things. -} diff --git a/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs b/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs index 94c5e5e5ffe..ad170baa737 100644 --- a/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs +++ b/plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DerivingStrategies #-} module PlutusBenchmark.NaturalSort (naturalSort) where