From 3621584ae62f6231e5e4bee2a1bb7c93940de677 Mon Sep 17 00:00:00 2001 From: Phil Ruffwind Date: Sat, 29 Jun 2024 20:54:20 -0700 Subject: [PATCH] TEST --- .github/workflows/build.yml | 11 +---------- main.c | 39 +++++++++++++++++++++++++++++++++++++ tools/testscript | 9 +++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 main.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65e3a6d1..29deb8a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,18 +14,9 @@ jobs: fail-fast: false matrix: include: - - { os: macOS-13, stack: lts-12.26, stack-extra-deps: "bytestring-0.11.3.0, 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, filepath-1.5.2.0, os-string-2.0.2, unix-2.8.5.1", stack-package-flags: "{directory: {os-string: true}, unix: {os-string: true}}", ghc-flags: -Werror=deprecations } - - { os: ubuntu-latest, ghc: 8.4.4, cabal: 3.0.0.0, overrides: "before_prepare() { sed -i.bak /utimensat/d configure.ac; }" } - - { os: ubuntu-latest, ghc: 8.6.5, cabal: 3.0.0.0, overrides: "before_prepare() { sed -i.bak /utimensat/d configure.ac; }" } - - { 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-12.26, stack-extra-deps: "bytestring-0.11.3.0, filepath-1.4.100.0, time-1.8.0.2, 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, 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, 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, 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}, Win32: {os-string: true}}", ghc-flags: -Werror=deprecations } runs-on: ${{ matrix.os }} env: CABAL_PACKAGE_FLAGS: ${{ matrix.cabal-package-flags }} diff --git a/main.c b/main.c new file mode 100644 index 00000000..464e7b31 --- /dev/null +++ b/main.c @@ -0,0 +1,39 @@ +#include +#include + +const wchar_t *error_string(DWORD code) +{ + static wchar_t message[1024]; + if (!FormatMessageW( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, code, 0, message, sizeof(message) / sizeof(*message), NULL)) { + wprintf(L"??? %d\n", GetLastError()); + return L"???"; + } + return message; +} + +static const wchar_t *dir = L"VERYLONGDIRECTORYNAME"; + +int main(void) +{ + wchar_t buf[512], buf2[512]; + if (!CreateDirectoryW(dir, NULL)) { + DWORD code = GetLastError(); + if (code != ERROR_ALREADY_EXISTS) { + wprintf(L"CreateDirectoryA: %ls\n", error_string(code)); + return 1; + } + } + if (!GetShortPathNameW(dir, buf, sizeof(buf) / sizeof(*buf))) { + wprintf(L"GetShortPathNameW: %ls\n", error_string(GetLastError())); + return 1; + } + wprintf(L"short path = %ls\n", buf); + if (!GetLongPathNameW(buf, buf2, sizeof(buf2) / sizeof(*buf2))) { + wprintf(L"GetLongPathNameW: %ls\n", error_string(GetLastError())); + return 1; + } + wprintf(L"short-then-long path = %ls\n", buf2); + return 0; +} diff --git a/tools/testscript b/tools/testscript index 194d9660..636f391b 100755 --- a/tools/testscript +++ b/tools/testscript @@ -12,6 +12,15 @@ before_prepare() { prepare() { before_prepare + + ( + ls /usr/bin/x86_64* + CC=x86_64-w64-mingw32-gcc + $CC -dumpmachine + $CC -Wall main.c + ./a.exe + ) + if [ -f configure.ac ]; then autoreconf -i fi