From e82c2aced25f1ddb8196d3b7935b60f71998dfaa Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 9 Mar 2022 10:49:05 +0100 Subject: [PATCH 1/5] Use std::cout for test status data --- test/test_iostream.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test_iostream.cpp b/test/test_iostream.cpp index ec84241e..d4200475 100644 --- a/test/test_iostream.cpp +++ b/test/test_iostream.cpp @@ -408,7 +408,7 @@ class RedirectStdio CONSOLE_SCREEN_BUFFER_INFO info; TEST(GetConsoleScreenBufferInfo(h, &info)); TEST(info.dwSize.X > 0 && info.dwSize.Y > 0); - nw::cout << "Mock console buffer size: " << info.dwSize.X << "x" << info.dwSize.Y << "\n"; + std::cout << "Mock console buffer size: " << info.dwSize.X << "x" << info.dwSize.Y << "\n"; std::wstring result; std::vector buffer(info.dwSize.X); @@ -426,7 +426,7 @@ class RedirectStdio return result; } - void setBufferData(std::wstring data, int) + void setBufferData(const std::wstring& data) { std::vector buffer; buffer.reserve(data.size() * 2 + 2); @@ -460,7 +460,7 @@ class RedirectStdio void test_console() { - // cin + std::cout << "Test cin console" << std::endl; { RedirectStdio stdinHandle(STD_INPUT_HANDLE); // Recreate to react on redirected streams @@ -468,14 +468,14 @@ void test_console() TEST(cin.rdbuf() != std::cin.rdbuf()); const std::string testStringIn1 = "Hello std in "; const std::string testStringIn2 = "\xc3\xa4 - \xc3\xb6 - \xc3\xbc - \xd0\xbc - \xce\xbd"; - stdinHandle.setBufferData(nw::widen(testStringIn1 + "\n" + testStringIn2 + "\n"), 0); + stdinHandle.setBufferData(nw::widen(testStringIn1 + "\n" + testStringIn2 + "\n")); std::string line; TEST(std::getline(cin, line)); TEST_EQ(line, testStringIn1); TEST(std::getline(cin, line)); TEST_EQ(line, testStringIn2); } - // cout + std::cout << "Test cout console" << std::endl; { RedirectStdio stdoutHandle(STD_OUTPUT_HANDLE); decltype(nw::cout) cout(true, nullptr); @@ -487,7 +487,7 @@ void test_console() const auto data = stdoutHandle.getBufferData(); TEST_EQ(data, nw::widen(testString)); } - // cerr + std::cout << "Test cerr console" << std::endl; { RedirectStdio stderrHandle(STD_ERROR_HANDLE); @@ -500,6 +500,7 @@ void test_console() const auto data = stderrHandle.getBufferData(); TEST_EQ(data, nw::widen(testString)); } + std::cout << "Console tests done" << std::endl; } #else From 5c46488d7aa41ef1a948ce1e396befa389404974 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 9 Mar 2022 16:04:23 +0100 Subject: [PATCH 2/5] Add more status messages to test_iostream Help to debug random timeouts on Appveyor --- test/test_iostream.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test_iostream.cpp b/test/test_iostream.cpp index d4200475..343d66f4 100644 --- a/test/test_iostream.cpp +++ b/test/test_iostream.cpp @@ -381,7 +381,13 @@ class RedirectStdio { if(handleType == STD_INPUT_HANDLE) { - h = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + h = CreateFile("CONIN$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + nullptr, + OPEN_EXISTING, + 0, + 0); } else { h = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, @@ -460,19 +466,26 @@ class RedirectStdio void test_console() { - std::cout << "Test cin console" << std::endl; + std::cout << "Test cin console: " << std::flush; { RedirectStdio stdinHandle(STD_INPUT_HANDLE); + std::cout << "stdin redirected, " << std::flush; // Recreate to react on redirected streams decltype(nw::cin) cin(nullptr); + std::cout << "cin recreated " << std::flush; TEST(cin.rdbuf() != std::cin.rdbuf()); + std::cout << "and validated" << std::endl; const std::string testStringIn1 = "Hello std in "; const std::string testStringIn2 = "\xc3\xa4 - \xc3\xb6 - \xc3\xbc - \xd0\xbc - \xce\xbd"; + std::cout << "Setting mock buffer data" << std::endl; stdinHandle.setBufferData(nw::widen(testStringIn1 + "\n" + testStringIn2 + "\n")); + std::cout << "Done" << std::endl; std::string line; TEST(std::getline(cin, line)); + std::cout << "ASCII line read" << std::endl; TEST_EQ(line, testStringIn1); TEST(std::getline(cin, line)); + std::cout << "UTF-8 line read" << std::endl; TEST_EQ(line, testStringIn2); } std::cout << "Test cout console" << std::endl; From 2c446d16a5325cd49a68f5b6ef94ead9f1812e9c Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 9 Mar 2022 10:50:35 +0100 Subject: [PATCH 3/5] CI: Update checkout action to v3 --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/ci_tests.yml | 10 +++++----- .github/workflows/release.yml | 2 +- .github/workflows/update_standalone.yml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6eacc7e..bef90b12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: git config --global pack.threads 0 ! command -v cmake &> /dev/null || echo "B2_FLAGS=--nowide-enable-cmake" >> $GITHUB_ENV - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' fetch-depth: ${{ matrix.coverage && '0' || '1' }} @@ -127,7 +127,7 @@ jobs: key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}} - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: boostorg/boost-ci ref: master @@ -236,7 +236,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup MSYS2 environment uses: msys2/setup-msys2@v2 @@ -247,7 +247,7 @@ jobs: pacboy: gcc:p cmake:p ninja:p - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: boostorg/boost-ci ref: master @@ -296,9 +296,9 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: boostorg/boost-ci ref: master diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 28c3656c..5b70f2d3 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -48,7 +48,7 @@ jobs: DEP_DIR: ${{github.workspace}}/dependencies BOOST_VERSION: 1.56.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Sanity check version run: grep -E 'set\(_version [0-9]' CMakeLists.txt - uses: actions/cache@v1 @@ -64,7 +64,7 @@ jobs: if: matrix.standalone == 'Boost' run: echo "BOOST_ROOT=${DEP_DIR//\\/\/}/boost_${BOOST_VERSION//./_}" >> $GITHUB_ENV # Install Boost - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' with: repository: boostorg/boost @@ -128,9 +128,9 @@ jobs: CreateBoostDocuTest: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: boostorg/boost-ci ref: master @@ -147,7 +147,7 @@ jobs: CheckFormatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: DoozyX/clang-format-lint-action@v0.11 with: exclude: './doc' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53ceb83b..a0b253f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: DEP_DIR: ${{github.workspace}}/dependencies BOOST_VERSION: 1.56.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract tag name id: get_tag run: | diff --git a/.github/workflows/update_standalone.yml b/.github/workflows/update_standalone.yml index 6e4c45e7..b74a818d 100644 --- a/.github/workflows/update_standalone.yml +++ b/.github/workflows/update_standalone.yml @@ -16,7 +16,7 @@ jobs: name: Update standalone branch runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup git run: | git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" From 27de233d30852c105236f4f55961863c8ad061ab Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 9 Mar 2022 10:53:36 +0100 Subject: [PATCH 4/5] CI: Add VS 2022 CMake test --- .appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index a5c4f280..25280cc9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -125,6 +125,11 @@ environment: GENERATOR: Visual Studio 16 2019 configuration: Debug BOOST_ROOT: C:\Libraries\boost_1_73_0 + - CMAKE: true + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + GENERATOR: Visual Studio 17 2022 + configuration: Debug + BOOST_ROOT: C:\Libraries\boost_1_77_0 # Coverity - COVERITY: true From 1e6badc0c1a0929463187c560f238e0a7ef22caf Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 9 Mar 2022 18:53:59 +0100 Subject: [PATCH 5/5] CI: Remove Visual Studio 2019 CMake test The cin emulation in the test fails on this image. --- .appveyor.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 25280cc9..8c11fd05 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -120,11 +120,6 @@ environment: GENERATOR: Visual Studio 14 2015 Win64 configuration: Debug BOOST_ROOT: C:\Libraries\boost_1_60_0 - - CMAKE: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - GENERATOR: Visual Studio 16 2019 - configuration: Debug - BOOST_ROOT: C:\Libraries\boost_1_73_0 - CMAKE: true APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 GENERATOR: Visual Studio 17 2022