From 4b88b0da16c3a23f463a70c1ca0f15e773115c6d Mon Sep 17 00:00:00 2001 From: Phil Ruffwind Date: Mon, 6 Jan 2025 03:09:31 -0800 Subject: [PATCH] DEBUG printenv --- .github/workflows/build.yml | 12 ++----- print_envs.hs | 5 +++ printenvs.c | 11 ++++++ tests/Main.hs | 70 +++++++++++++++++++++---------------- tools/testscript | 2 +- 5 files changed, 58 insertions(+), 42 deletions(-) create mode 100644 print_envs.hs create mode 100644 printenvs.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22e18f45..c3f7ee1c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,16 +14,8 @@ jobs: fail-fast: false matrix: include: - - { os: macOS-13, stack: lts-15.3, stack-extra-deps: "bytestring-0.11.3.0, file-io-0.1.4, filepath-1.4.100.0, unix-2.8.0.0" } - - { os: macos-latest, stack: lts-22.7, stack-extra-deps: "bytestring-0.11.5.3, file-io-0.1.4, filepath-1.5.2.0, os-string-2.0.2, unix-2.8.5.1", stack-package-flags: "{directory: {os-string: true}, file-io: {os-string: true}, unix: {os-string: true}}", ghc-flags: -Werror=deprecations } - - { os: ubuntu-latest, ghc: 8.10.7, cabal: 3.8.1.0 } - - { os: ubuntu-latest, ghc: 9.0.2, cabal: 3.8.1.0 } - - { os: ubuntu-latest, ghc: 9.2.4, cabal: 3.8.1.0 } - - { os: ubuntu-latest, ghc: 9.4.3, cabal: 3.8.1.0 } - - { os: ubuntu-latest, ghc: latest, cabal: latest, cabal-package-flags: +os-string, ghc-flags: -Werror=deprecations } - - { os: windows-latest, stack: lts-15.3, stack-extra-deps: "bytestring-0.11.3.0, file-io-0.1.4, filepath-1.4.100.0, time-1.9.3, Win32-2.13.3.0", overrides: "before_prepare() { sed -i.bak -e /CreateSymbolicLinkW/d -e /GetFinalPathNameByHandleW/d configure.ac; }" } - - { os: windows-latest, stack: lts-17.5, stack-extra-deps: "bytestring-0.11.3.0, file-io-0.1.4, filepath-1.4.100.0, time-1.9.3, Win32-2.13.3.0" } - - { os: windows-latest, stack: lts-22.7, stack-extra-deps: "bytestring-0.11.5.3, file-io-0.1.4, filepath-1.5.2.0, os-string-2.0.2, time-1.14, Win32-2.14.0.0", stack-package-flags: "{directory: {os-string: true}, file-io: {os-string: true}, Win32: {os-string: true}}", ghc-flags: -Werror=deprecations } + - { os: ubuntu-latest, ghc: 9.10.1, cabal: 3.14.1.0, cabal-package-flags: +os-string, ghc-flags: -Werror=deprecations } + - { os: ubuntu-latest, ghc: 9.12.1, cabal: 3.14.1.0, cabal-package-flags: +os-string, ghc-flags: -Werror=deprecations } runs-on: ${{ matrix.os }} env: CABAL_PACKAGE_FLAGS: ${{ matrix.cabal-package-flags }} diff --git a/print_envs.hs b/print_envs.hs new file mode 100644 index 00000000..b5624a6a --- /dev/null +++ b/print_envs.hs @@ -0,0 +1,5 @@ +module Main where +import System.Environment +import Data.List + +main = print =<< fmap (sort . fmap fst) getEnvironment diff --git a/printenvs.c b/printenvs.c new file mode 100644 index 00000000..e2776691 --- /dev/null +++ b/printenvs.c @@ -0,0 +1,11 @@ +#include +#include + +extern char **environ; + +int main(void) { + int i; + for (i = 0; environ[i]; ++i) { + printf("printenvs: %s\n", strtok(environ[i], "=")); + } +} diff --git a/tests/Main.hs b/tests/Main.hs index 227e5727..d9c64824 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -1,4 +1,6 @@ module Main (main) where +import System.Environment +import Data.List import qualified Util as T import qualified CanonicalizePath import qualified CopyFile001 @@ -34,34 +36,40 @@ import qualified Xdg main :: IO () main = T.testMain $ \ _t -> do - T.isolatedRun _t "CanonicalizePath" CanonicalizePath.main - T.isolatedRun _t "CopyFile001" CopyFile001.main - T.isolatedRun _t "CopyFile002" CopyFile002.main - T.isolatedRun _t "CopyFileWithMetadata" CopyFileWithMetadata.main - T.isolatedRun _t "CreateDirectory001" CreateDirectory001.main - T.isolatedRun _t "CreateDirectoryIfMissing001" CreateDirectoryIfMissing001.main - T.isolatedRun _t "CurrentDirectory001" CurrentDirectory001.main - T.isolatedRun _t "Directory001" Directory001.main - T.isolatedRun _t "DoesDirectoryExist001" DoesDirectoryExist001.main - T.isolatedRun _t "DoesPathExist" DoesPathExist.main - T.isolatedRun _t "FileTime" FileTime.main - T.isolatedRun _t "FindFile001" FindFile001.main - T.isolatedRun _t "GetDirContents001" GetDirContents001.main - T.isolatedRun _t "GetDirContents002" GetDirContents002.main - T.isolatedRun _t "GetFileSize" GetFileSize.main - T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main - T.isolatedRun _t "GetHomeDirectory002" GetHomeDirectory002.main - T.isolatedRun _t "GetPermissions001" GetPermissions001.main - T.isolatedRun _t "LongPaths" LongPaths.main - T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main - T.isolatedRun _t "MinimizeNameConflicts" MinimizeNameConflicts.main - T.isolatedRun _t "PathIsSymbolicLink" PathIsSymbolicLink.main - T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main - T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main - T.isolatedRun _t "RenameDirectory" RenameDirectory.main - T.isolatedRun _t "RenameFile001" RenameFile001.main - T.isolatedRun _t "RenamePath" RenamePath.main - T.isolatedRun _t "Simplify" Simplify.main - T.isolatedRun _t "T8482" T8482.main - T.isolatedRun _t "WithCurrentDirectory" WithCurrentDirectory.main - T.isolatedRun _t "Xdg" Xdg.main + putStrLn "!!!!!!!!!!!! 1" + print =<< fmap (sort . fmap fst) getEnvironment + -- T.isolatedRun _t "CanonicalizePath" CanonicalizePath.main + -- T.isolatedRun _t "CopyFile001" CopyFile001.main + -- T.isolatedRun _t "CopyFile002" CopyFile002.main + -- T.isolatedRun _t "CopyFileWithMetadata" CopyFileWithMetadata.main + -- T.isolatedRun _t "CreateDirectory001" CreateDirectory001.main + -- T.isolatedRun _t "CreateDirectoryIfMissing001" CreateDirectoryIfMissing001.main + -- T.isolatedRun _t "CurrentDirectory001" CurrentDirectory001.main + -- T.isolatedRun _t "Directory001" Directory001.main + -- T.isolatedRun _t "DoesDirectoryExist001" DoesDirectoryExist001.main + -- T.isolatedRun _t "DoesPathExist" DoesPathExist.main + -- T.isolatedRun _t "FileTime" FileTime.main + -- T.isolatedRun _t "FindFile001" FindFile001.main + -- putStrLn "!!!!!!!!!!!! 2" + -- print =<< fmap (sort . fmap fst) getEnvironment + -- T.isolatedRun _t "GetDirContents001" GetDirContents001.main + -- T.isolatedRun _t "GetDirContents002" GetDirContents002.main + -- T.isolatedRun _t "GetFileSize" GetFileSize.main + -- T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main + -- T.isolatedRun _t "GetHomeDirectory002" GetHomeDirectory002.main + -- T.isolatedRun _t "GetPermissions001" GetPermissions001.main + -- T.isolatedRun _t "LongPaths" LongPaths.main + -- T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main + -- T.isolatedRun _t "MinimizeNameConflicts" MinimizeNameConflicts.main + -- T.isolatedRun _t "PathIsSymbolicLink" PathIsSymbolicLink.main + -- T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main + -- T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main + -- T.isolatedRun _t "RenameDirectory" RenameDirectory.main + -- T.isolatedRun _t "RenameFile001" RenameFile001.main + -- T.isolatedRun _t "RenamePath" RenamePath.main + -- T.isolatedRun _t "Simplify" Simplify.main + -- T.isolatedRun _t "T8482" T8482.main + -- T.isolatedRun _t "WithCurrentDirectory" WithCurrentDirectory.main + -- putStrLn "!!!!!!!!!!!! 3" + -- print =<< fmap (sort . fmap fst) getEnvironment + -- T.isolatedRun _t "Xdg" Xdg.main diff --git a/tools/testscript b/tools/testscript index 194d9660..361c0a35 100755 --- a/tools/testscript +++ b/tools/testscript @@ -53,7 +53,7 @@ build() { $stack sdist else testflags=`printf " %s" "$testflags" | sed "s/ / --test-option=/g"` - cabal v2-test --keep-going --test-show-details=streaming $testflags + cabal -v v2-test --keep-going --test-show-details=streaming $testflags cabal check cabal v2-sdist cabal v1-install --force-reinstalls --run-tests dist-newstyle/sdist/*-*.tar.gz