github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/c-deps/libroach/ccl/crypto_utils_test.cc (about)

     1  // Copyright 2017 The Cockroach Authors.
     2  //
     3  // Licensed as a CockroachDB Enterprise file under the Cockroach Community
     4  // License (the "License"); you may not use this file except in compliance with
     5  // the License. You may obtain a copy of the License at
     6  //
     7  //     https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt
     8  
     9  #include "../testutils.h"
    10  #include "crypto_utils.h"
    11  
    12  TEST(CryptoUtils, HasAESNI) { EXPECT_TRUE(UsesAESNI()); }
    13  
    14  #ifdef _WIN32
    15  
    16  TEST(CryptoUtils, DisableCoreDumps) {
    17    EXPECT_ERR(DisableCoreFile(), ".* not supported on Windows");
    18  }
    19  
    20  #else
    21  
    22  #include <sys/resource.h>
    23  #include <sys/time.h>
    24  #include <sys/types.h>
    25  
    26  TEST(CryptoUtils, DisableCoreDumps) {
    27    rlimit lim = {1 << 10, 2 << 10};
    28    ASSERT_EQ(0, setrlimit(RLIMIT_CORE, &lim));
    29  
    30    EXPECT_OK(DisableCoreFile());
    31    ASSERT_EQ(0, getrlimit(RLIMIT_CORE, &lim));
    32    EXPECT_EQ(0, lim.rlim_cur);
    33    EXPECT_EQ(0, lim.rlim_max);
    34  }
    35  
    36  #endif