tests: Prevent false failures of test cases for Ethernet face

Change-Id: I2a767278560209c2e1ee88a3321e6b8e320039fb
Refs: #1393
diff --git a/tests/daemon/face/ethernet.cpp b/tests/daemon/face/ethernet.cpp
index 936406b..7df879c 100644
--- a/tests/daemon/face/ethernet.cpp
+++ b/tests/daemon/face/ethernet.cpp
@@ -39,6 +39,8 @@
 protected:
   InterfacesFixture()
   {
+    EthernetFactory factory;
+
     std::list< shared_ptr<NetworkInterfaceInfo> > ifs = listNetworkInterfaces();
     for (std::list< shared_ptr<NetworkInterfaceInfo> >::const_iterator i = ifs.begin();
          i != ifs.end();
@@ -46,14 +48,14 @@
       {
         if (!(*i)->isLoopback() && (*i)->isUp())
           {
-            pcap_t* p = pcap_create((*i)->name.c_str(), 0);
-            if (!p)
+            try {
+              factory.createMulticastFace(*i, ethernet::getBroadcastAddress());
+            }
+            catch (Face::Error&) {
               continue;
+            }
 
-            if (pcap_activate(p) == 0)
-              m_interfaces.push_back(*i);
-
-            pcap_close(p);
+            m_interfaces.push_back(*i);
           }
       }
   }
@@ -73,19 +75,16 @@
       return;
     }
 
-  shared_ptr<EthernetFace> face1;
-  BOOST_REQUIRE_NO_THROW(face1 = factory.createMulticastFace(m_interfaces.front(),
-                                                             ethernet::getBroadcastAddress()));
-  shared_ptr<EthernetFace> face1bis;
-  BOOST_REQUIRE_NO_THROW(face1bis = factory.createMulticastFace(m_interfaces.front(),
-                                                                ethernet::getBroadcastAddress()));
+  shared_ptr<EthernetFace> face1 = factory.createMulticastFace(m_interfaces.front(),
+                                                               ethernet::getBroadcastAddress());
+  shared_ptr<EthernetFace> face1bis = factory.createMulticastFace(m_interfaces.front(),
+                                                                  ethernet::getBroadcastAddress());
   BOOST_CHECK_EQUAL(face1, face1bis);
 
   if (m_interfaces.size() > 1)
     {
-      shared_ptr<EthernetFace> face2;
-      BOOST_REQUIRE_NO_THROW(face2 = factory.createMulticastFace(m_interfaces.back(),
-                                                                 ethernet::getBroadcastAddress()));
+      shared_ptr<EthernetFace> face2 = factory.createMulticastFace(m_interfaces.back(),
+                                                                   ethernet::getBroadcastAddress());
       BOOST_CHECK_NE(face1, face2);
     }
   else
@@ -94,9 +93,8 @@
                          "only one interface available");
     }
 
-  shared_ptr<EthernetFace> face3;
-  BOOST_REQUIRE_NO_THROW(face3 = factory.createMulticastFace(m_interfaces.front(),
-                                                             ethernet::getDefaultMulticastAddress()));
+  shared_ptr<EthernetFace> face3 = factory.createMulticastFace(m_interfaces.front(),
+                                     ethernet::getDefaultMulticastAddress());
   BOOST_CHECK_NE(face1, face3);
 }
 
@@ -111,7 +109,7 @@
     }
 
   shared_ptr<EthernetFace> face = factory.createMulticastFace(m_interfaces.front(),
-                                                              ethernet::getDefaultMulticastAddress());
+                                    ethernet::getDefaultMulticastAddress());
 
   BOOST_REQUIRE(static_cast<bool>(face));
 
@@ -122,24 +120,15 @@
   BOOST_CHECK_EQUAL(face->getLocalUri().toString(),
                     "dev://" + m_interfaces.front()->name);
 
-  Interest interest1("ndn:/TpnzGvW9R");
-  Data     data1    ("ndn:/KfczhUqVix");
-  data1.setContent(0, 0);
-  Interest interest2("ndn:/QWiIMfj5sL");
-  Data     data2    ("ndn:/XNBV796f");
-  data2.setContent(0, 0);
+  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
+  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
+  shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL");
+  shared_ptr<Data>     data2     = makeData("ndn:/XNBV796f");
 
-  ndn::SignatureSha256WithRsa fakeSignature;
-  fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
-
-  // set fake signature on data1 and data2
-  data1.setSignature(fakeSignature);
-  data2.setSignature(fakeSignature);
-
-  BOOST_CHECK_NO_THROW(face->sendInterest(interest1));
-  BOOST_CHECK_NO_THROW(face->sendData    (data1    ));
-  BOOST_CHECK_NO_THROW(face->sendInterest(interest2));
-  BOOST_CHECK_NO_THROW(face->sendData    (data2    ));
+  BOOST_CHECK_NO_THROW(face->sendInterest(*interest1));
+  BOOST_CHECK_NO_THROW(face->sendData    (*data1    ));
+  BOOST_CHECK_NO_THROW(face->sendInterest(*interest2));
+  BOOST_CHECK_NO_THROW(face->sendData    (*data2    ));
 
 //  m_ioRemaining = 4;
 //  m_ioService.run();
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 6ad6197..0f53b93 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -671,7 +671,10 @@
   shared_ptr<UdpFactory> factory = static_pointer_cast<UdpFactory>(getManager().findFactory("udp"));
   BOOST_REQUIRE(static_cast<bool>(factory));
 
-  BOOST_CHECK_GT(factory->getMulticastFaces().size(), 0);
+  if (factory->getMulticastFaces().size() == 0) {
+    BOOST_TEST_MESSAGE("Destroying multicast faces is not tested because "
+                       "no UDP multicast faces are available");
+  }
 
   const std::string CONFIG_WITHOUT_MCAST =
     "face_system\n"
@@ -783,7 +786,10 @@
     static_pointer_cast<EthernetFactory>(getManager().findFactory("ether"));
   BOOST_REQUIRE(static_cast<bool>(factory));
 
-  BOOST_CHECK_GT(factory->getMulticastFaces().size(), 0);
+  if (factory->getMulticastFaces().size() == 0) {
+    BOOST_TEST_MESSAGE("Destroying multicast faces is not tested because "
+                       "no Ethernet multicast faces are available");
+  }
 
   const std::string CONFIG_WITHOUT_MCAST =
     "face_system\n"