Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures and compiler warnings #126

Merged
merged 4 commits into from
Jan 23, 2024

Conversation

ellert
Copy link
Contributor

@ellert ellert commented Jun 19, 2023

  • Fix some compiler warnings
    .../src/scitokens_internal.h:673:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
      673 |         return std::move(result);
          |                ~~~~~~~~~^~~~~~~~
    .../src/scitokens_internal.h:673:25: note: remove 'std::move' call
    
    .../src/scitokens_internal.cpp:633:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
      633 |         return std::move(status);
          |                ~~~~~~~~~^~~~~~~~
    .../src/scitokens_internal.cpp:633:25: note: remove 'std::move' call
    
    .../src/scitokens_internal.cpp:747:13: warning: unused variable 'next_update' [-Wunused-variable]
      747 |     int64_t next_update, expires;
          |             ^~~~~~~~~~~
    
    .../src/scitokens_internal.cpp:747:26: warning: unused variable 'expires' [-Wunused-variable]
      747 |     int64_t next_update, expires;
          |                          ^~~~~~~
    
    .../test/main.cpp:442:12: warning: unused variable 'now' [-Wunused-variable]
      442 |     time_t now = time(NULL);
          |            ^~~
  • Move key cache tests to the end to avoid random failures in other tests due to interference from changing the cache expiration settings in the key cache tests.

  • Print err_msg in case of error

  • Use resize() instead of reserve() to allocate vector elements

    [ RUN      ] SerializeTest.VerifyTest
    /usr/include/c++/13/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

[ RUN      ] SerializeTest.VerifyTest
/usr/include/c++/13/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
tests due to interference from changing the cache expiration settings
in the key cache tests.
.../src/scitokens_internal.h:673:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  673 |         return std::move(result);
      |                ~~~~~~~~~^~~~~~~~
.../src/scitokens_internal.h:673:25: note: remove 'std::move' call

.../src/scitokens_internal.cpp:633:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  633 |         return std::move(status);
      |                ~~~~~~~~~^~~~~~~~
.../src/scitokens_internal.cpp:633:25: note: remove 'std::move' call

.../src/scitokens_internal.cpp:747:13: warning: unused variable 'next_update' [-Wunused-variable]
  747 |     int64_t next_update, expires;
      |             ^~~~~~~~~~~

.../src/scitokens_internal.cpp:747:26: warning: unused variable 'expires' [-Wunused-variable]
  747 |     int64_t next_update, expires;
      |                          ^~~~~~~

.../test/main.cpp:442:12: warning: unused variable 'now' [-Wunused-variable]
  442 |     time_t now = time(NULL);
      |            ^~~
@olifre
Copy link
Contributor

olifre commented Jan 23, 2024

Many thanks, @ellert !

To weigh in on this, the std::vector issue has also popped up on Gentoo Hardened systems, so we'll now also have to carry a downstream patch there:
gentoo/gentoo#34980

It would be nice to see these fixes merged in the next release so distro patches can be dropped again.

Copy link
Contributor

@djw8605 djw8605 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing this pull request, looks good to me

@djw8605 djw8605 merged commit 892076d into scitokens:master Jan 23, 2024
@olifre
Copy link
Contributor

olifre commented Jan 23, 2024

@djw8605 Many thanks, much appreciated 👍 .

@ellert ellert deleted the test-failures-and-compiler-warnings branch January 25, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants