Release 0.1.58.6
[platform/core/security/key-manager.git] / unit-tests / test_descriptor-set.cpp
index fb985bb..22bc578 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2014 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *  Copyright (c) 2014-2020 Samsung Electronics Co., Ltd. All rights reserved
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@
 
 #include <descriptor-set.h>
 #include <dpl/errno_string.h>
+#include <utils.h>
 
 using namespace CKM;
 
@@ -47,8 +48,6 @@ namespace {
 const int POLL_TIMEOUT = 8000;
 const int POLL_TIMEOUT_SHORT = 1000;
 
-typedef std::unique_ptr<int[], std::function<void(int *)>> PipePtr;
-
 const short POLLALL = std::numeric_limits<short>::max();
 
 void closePipe(int *fd)
@@ -65,7 +64,7 @@ void closePipe(int *fd)
 #define PIPE(fd) \
        int (fd)[2]; \
        BOOST_REQUIRE_MESSAGE(0 == pipe((fd)), "Pipe creation failed: " << GetErrnoString()); \
-       PipePtr fd##Ptr((fd), closePipe);
+       auto fd##Ptr = uptr<closePipe>((fd));
 
 void unexpectedCallback(int, short)
 {
@@ -262,10 +261,10 @@ POSITIVE_TEST_CASE(T090_WriteAfterRead)
                readFd(desc, fd[0], revents);
 
                descriptors.remove(desc);
-               descriptors.add(fd2[1], POLLOUT, [&](int desc, short revents) {
+               descriptors.add(fd2[1], POLLOUT, [&](int desc2, short revents2) {
                        callback2 = true;
-                       writeFd(desc, fd2[1], revents);
-                       descriptors.remove(desc);
+                       writeFd(desc2, fd2[1], revents2);
+                       descriptors.remove(desc2);
                });
        });