Description: Move tests that trigger -Warray-bounds to separate compilation unit GCC 10 is now smart enough to detect violation of array boundaries that tests are actually tested. Along with -Werror this led to tests failure, so I move such tests to another compilation unit to have the warning deactivated for only these tests. Bug-Debian: https://bugs.debian.org/966895 Author: Nicholas Guriev Last-Modified: Wed, 19 Aug 2020 08:55:52 +0300 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -179,6 +179,7 @@ add_gsl_test(owner_tests) add_gsl_test(byte_tests) add_gsl_test(algorithm_tests) add_gsl_test(strict_notnull_tests) +add_gsl_test(array_bounds) # No exception tests --- /dev/null +++ b/tests/array_bounds.cpp @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUC__ +#pragma GCC diagnostic warning "-Warray-bounds" +#endif // __GNUC__ + +#include + +#include // for gsl::multi_span + +namespace gsl +{ +struct fail_fast; +} // namespace gsl + +namespace +{ +static constexpr char deathstring[] = "Expected Death"; +} // namespace + +TEST(array_bounds, subspan_from_multi_span_test) +{ + int arr[5] = {1, 2, 3, 4, 5}; + gsl::multi_span av = arr; + + std::set_terminate([] { + std::cerr << "Expected Death. subspan"; + std::abort(); + }); + + EXPECT_DEATH(av.subspan(6).length(), deathstring); +} + +TEST(array_bounds, strided_span_bounds_from_strided_span_tests) +{ + int arr[] = {0, 1, 2, 3}; + gsl::multi_span av(arr); + + std::set_terminate([] { + std::cerr << "Expected Death. strided_span_bounds"; + std::abort(); + }); + + // incorrect sections + EXPECT_DEATH(av.section(0, 0)[0], deathstring); + EXPECT_DEATH(av.section(1, 0)[0], deathstring); + EXPECT_DEATH(av.section(1, 1)[1], deathstring); + + EXPECT_DEATH(av.section(2, 5), deathstring); + EXPECT_DEATH(av.section(5, 2), deathstring); + EXPECT_DEATH(av.section(5, 0), deathstring); + EXPECT_DEATH(av.section(0, 5), deathstring); + EXPECT_DEATH(av.section(5, 5), deathstring); +} --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -1042,10 +1042,6 @@ TEST(multi_span_test, subspan) EXPECT_TRUE(av.subspan(1).length() == 4); EXPECT_TRUE(av.subspan(4).length() == 1); EXPECT_TRUE(av.subspan(5).length() == 0); - // Disabled test instead of fixing since multi_span is deprecated. (PR#835) -#if !(defined(__GNUC__) && __GNUC__ == 8) - EXPECT_DEATH(av.subspan(6).length(), deathstring); -#endif auto av2 = av.subspan(1); for (int i = 0; i < 4; ++i) EXPECT_TRUE(av2[i] == i + 2); } --- a/tests/strided_span_tests.cpp +++ b/tests/strided_span_tests.cpp @@ -403,20 +403,6 @@ TEST(strided_span_tests, strided_span_bo }); { - // incorrect sections - - EXPECT_DEATH(av.section(0, 0)[0], deathstring); - EXPECT_DEATH(av.section(1, 0)[0], deathstring); - EXPECT_DEATH(av.section(1, 1)[1], deathstring); - - EXPECT_DEATH(av.section(2, 5), deathstring); - EXPECT_DEATH(av.section(5, 2), deathstring); - EXPECT_DEATH(av.section(5, 0), deathstring); - EXPECT_DEATH(av.section(0, 5), deathstring); - EXPECT_DEATH(av.section(5, 5), deathstring); - } - - { // zero stride strided_span sav{av, {{4}, {}}}; EXPECT_TRUE(sav[0] == 0); t 2022-01-14installer: Check if ci.guix.gnu.org can be reached....* gnu/installer.scm (installer-program): Add gnutls extension. * gnu/installer/newt/network.scm (wait-service-online): Check if the CI server can be reached. Mathieu Othacehe 2020-11-07installer: Limit listbox height....Fixes: <https://issues.guix.gnu.org/44428>. * gnu/installer/newt.scm (init): Print screen size. * gnu/installer/newt/page.scm (default-listbox-height): New variable. (run-listbox-selection-page): Use it. * gnu/installer/newt/wifi.scm (wifi-listbox-height): Ditto. * gnu/installer/newt/network.scm (run-technology-page): Set the maximum listbox height to 5. * gnu/installer/newt/ethernet.scm (run-ethernet-page): Ditto. * gnu/installer/newt/final.scm (run-config-display-page): Change listbox height. * gnu/installer/newt/partition.scm (run-disk-page): Ditto. * gnu/installer/newt/welcome.scm (display-logo?): New procedure. (run-menu-page): Use it. * gnu/installer/steps.scm (%configuration-file-width): Remove it. Mathieu Othacehe 2020-03-05installer: Bypass connectivity check when /tmp/installer-assume-online exists....This is useful for automated tests. * gnu/installer/newt/network.scm (wait-service-online)[online?]: New procedure. Check for /tmp/installer-assume-online. Use it instead of 'connman-online?'. Ludovic Courtès