quiche: import some quic test utilities#7709
quiche: import some quic test utilities#7709mattklein123 merged 10 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @wu-bin @alyssawilk |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/retest |
|
🔨 rebuilding |
|
/retest |
|
🔨 rebuilding |
|
|
||
| TEST_F(QuicPlatformTest, LogEndOfLine) { | ||
| GetLogger().set_level(ERROR); | ||
| QUIC_DLOG(ERROR) << "aaaa" << std::endl; |
There was a problem hiding this comment.
Does this emit an extra empty new line compared to QUIC_DLOG(ERROR) << "aaaa";?
If yes, can we strip the ending new lines in quic logging impl?
| #define VALUE_BY_COMPILE_MODE(debug_mode_value, release_mode_value) debug_mode_value | ||
| #endif | ||
|
|
||
| TEST_F(QuicPlatformTest, LogEndOfLine) { |
There was a problem hiding this comment.
Can we test a few more io manipulators? Some code may use std::hex, std::dec, std::fixed etc.
Also please change the test name to something like QuicLogIoManipulators.
Signed-off-by: Dan Zhang <danzh@google.com>
| } | ||
| GetLogger().log(level_, "{}", stream_.str().c_str()); | ||
| std::string content = stream_.str(); | ||
| if (content.back() == '\n') { |
There was a problem hiding this comment.
Check if content is empty before calling back().
| if (content.back() == '\n') { | ||
| // strip the last trailing '\n' because spd log will add a trailing '\n' to | ||
| // the output. | ||
| content.replace(content.length() - 1, 1, 1, '\0'); |
There was a problem hiding this comment.
You can just do content.back() = '\0';
|
|
||
| TEST_F(QuicPlatformTest, LogEndOfLine) { | ||
| GetLogger().set_level(ERROR); | ||
| QUIC_DLOG(ERROR) << "aaaa" << std::endl; |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @mattklein123 |
|
ping? @mattklein123 |
Bring quic/test_tools/quic_test_utils.h and quic/test_tools/crypto_test_utils.h for future testing. As crypto_test_utils.h has platform-dependent interfaces, their definitions is added in test/extensions/quic_listeners/quiche/crypto_test_utils_for_envoy.cc.
Risk Level: low, test only
Testing: no tested as the platform specific function definitions are quite straight forward
Part of: #2557