From 9a65377fdca6e9690235453a31feee7786763228 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com> Date: Tue, 16 Jul 2024 10:01:52 +1200 Subject: [PATCH] Add src-loc test for 32 bit pseudo relocation issue See #2228 --- test/default.nix | 1 + test/src-loc/default.nix | 25 +++++++++++++++++++++++++ test/src-loc/src-loc.cabal | 13 +++++++++++++ test/src-loc/src/Main.hs | 9 +++++++++ 4 files changed, 48 insertions(+) create mode 100644 test/src-loc/default.nix create mode 100644 test/src-loc/src-loc.cabal create mode 100644 test/src-loc/src/Main.hs diff --git a/test/default.nix b/test/default.nix index e1784beb49..f7ac3ae261 100644 --- a/test/default.nix +++ b/test/default.nix @@ -233,6 +233,7 @@ let plugin = callTest ./plugin {}; supported-languages = callTest ./supported-langauges {}; js-template-haskell = callTest ./js-template-haskell {}; + src-loc = callTest ./src-loc { inherit util; }; unit = unitTests; }; diff --git a/test/src-loc/default.nix b/test/src-loc/default.nix new file mode 100644 index 0000000000..060fb8d226 --- /dev/null +++ b/test/src-loc/default.nix @@ -0,0 +1,25 @@ +# See https://github.com/input-output-hk/haskell.nix/issues/2228 +{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }: + +with lib; + +let + project = project' { + inherit compiler-nix-name evalPackages; + src = testSrc "src-loc"; + }; + + packages = project.hsPkgs; + +in recurseIntoAttrs rec { + meta.disabled = stdenv.hostPlatform.isGhcjs; + + ifdInputs = { + inherit (project) plan-nix; + }; + + build = packages.src-loc.components.exes.src-loc; + check = haskellLib.check build; + build-profiled = packages.src-loc.components.exes.src-loc.profiled; + check-profiled = haskellLib.check build-profiled; +} diff --git a/test/src-loc/src-loc.cabal b/test/src-loc/src-loc.cabal new file mode 100644 index 0000000000..a3b5731cc2 --- /dev/null +++ b/test/src-loc/src-loc.cabal @@ -0,0 +1,13 @@ +cabal-version: >=1.10 +name: src-loc +version: 0.1.0.0 +license: PublicDomain +author: Hamish Mackenzie +maintainer: Hamish.K.Mackenzie@gmail.com +build-type: Simple + +executable src-loc + build-depends: base + main-is: Main.hs + hs-source-dirs: src + default-language: Haskell2010 diff --git a/test/src-loc/src/Main.hs b/test/src-loc/src/Main.hs new file mode 100644 index 0000000000..e74e25e538 --- /dev/null +++ b/test/src-loc/src/Main.hs @@ -0,0 +1,9 @@ +module Main where + +import GHC.Types.SrcLoc + +main :: IO () +main = putStrLn "yeah" + +data Foo = Foo PsLoc +