Add sctp authentication to sctp_lib
This only works for linux >=5.4. When enabled, it will use
a shared key to authenticate messages. The functionality is
controlled by a flag and behind a linux version check.
Performance degradation is minimal, even for smaller messages
and unnoticeable when measuring overall system performance.
Change-Id: I836e61ec38a0c116fd7244b771437738ccca9828
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index df16d58..ec4bfe4 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -4,6 +4,7 @@
#include <optional>
#include <string>
+#include "gmock/gmock-matchers.h"
#include "gtest/gtest.h"
#include "aos/realtime.h"
@@ -13,6 +14,8 @@
namespace util {
namespace testing {
+using ::testing::ElementsAre;
+
// Basic test of reading a normal file.
TEST(FileTest, ReadNormalFile) {
const std::string tmpdir(aos::testing::TestTmpDir());
@@ -21,6 +24,15 @@
EXPECT_EQ("contents\n", ReadFileToStringOrDie(test_file));
}
+// Basic test of reading a normal file.
+TEST(FileTest, ReadNormalFileToBytes) {
+ const std::string tmpdir(aos::testing::TestTmpDir());
+ const std::string test_file = tmpdir + "/test_file";
+ ASSERT_EQ(0, system(("echo contents > " + test_file).c_str()));
+ EXPECT_THAT(ReadFileToVecOrDie(test_file),
+ ElementsAre('c', 'o', 'n', 't', 'e', 'n', 't', 's', '\n'));
+}
+
// Tests reading a file with 0 size, among other weird things.
TEST(FileTest, ReadSpecialFile) {
const std::string stat = ReadFileToStringOrDie("/proc/self/stat");