tests: fix running with non-root user
Refs: #3418 Change-Id: If7f5c05baaff0cf748c87c77057517928539df0d
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
* Copyright (c) 2014-2016, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -62,6 +62,11 @@ public:
|
||||
" udp\n"
|
||||
" {\n"
|
||||
" port " + port + "\n"
|
||||
" mcast no\n"
|
||||
" }\n"
|
||||
" ether\n"
|
||||
" {\n"
|
||||
" mcast no\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"authorizations\n"
|
||||
@@ -457,5 +462,5 @@ BOOST_AUTO_TEST_SUITE_END() // CreateFace
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestFaceManager
|
||||
BOOST_AUTO_TEST_SUITE_END() // Mgmt
|
||||
|
||||
} // tests
|
||||
} // nfd
|
||||
} // namespace tests
|
||||
} // namespace nfd
|
||||
|
||||
@@ -157,6 +157,8 @@ BOOST_AUTO_TEST_CASE(ProcessSectionTcpUnknownOption)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ProcessSectionUdp)
|
||||
{
|
||||
SKIP_IF_NOT_SUPERUSER();
|
||||
|
||||
const std::string CONFIG =
|
||||
"face_system\n"
|
||||
"{\n"
|
||||
@@ -294,6 +296,8 @@ BOOST_AUTO_TEST_CASE(ProcessSectionUdpUnknownOption)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ProcessSectionUdpMulticastReinit)
|
||||
{
|
||||
SKIP_IF_NOT_SUPERUSER();
|
||||
|
||||
const std::string CONFIG_WITH_MCAST =
|
||||
"face_system\n"
|
||||
"{\n"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
* Copyright (c) 2014-2016, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -66,6 +66,8 @@ BOOST_AUTO_TEST_CASE(DefaultConfig)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(UserAndGroupConfig)
|
||||
{
|
||||
SKIP_IF_NOT_SUPERUSER();
|
||||
|
||||
const std::string CONFIG =
|
||||
"general\n"
|
||||
"{\n"
|
||||
@@ -81,6 +83,8 @@ BOOST_AUTO_TEST_CASE(UserAndGroupConfig)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NoUserConfig)
|
||||
{
|
||||
SKIP_IF_NOT_SUPERUSER();
|
||||
|
||||
const std::string CONFIG =
|
||||
"general\n"
|
||||
"{\n"
|
||||
|
||||
+14
-1
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
* Copyright (c) 2014-2016, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -34,6 +34,19 @@
|
||||
#include <ndn-cxx/util/time-unit-test-clock.hpp>
|
||||
#include <ndn-cxx/security/key-chain.hpp>
|
||||
|
||||
#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE
|
||||
#include <unistd.h>
|
||||
#define SKIP_IF_NOT_SUPERUSER() \
|
||||
do { \
|
||||
if (::geteuid() != 0) { \
|
||||
BOOST_TEST_MESSAGE("This test case needs to be run as superuser, skipping"); \
|
||||
return; \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
#define SKIP_IF_NOT_SUPERUSER()
|
||||
#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE
|
||||
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user