Commit 19de0806 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

test/mock: add pthread_self



This will be used to simulate multi-threading for
bdev unit tests.

While here, alphabetize the existing calls - calloc
had been inserted out of order in a couple of places.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I559cd1fd79e78f03ebdac313e0bbedbcdde4a8c1

Reviewed-on: https://review.gerrithub.io/377968


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent 76774528
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -121,4 +121,6 @@ DECLARE_WRAPPER(pthread_mutex_init, int,
DECLARE_WRAPPER(pthread_mutexattr_init, int,
		(pthread_mutexattr_t *attr));

DECLARE_WRAPPER(pthread_self, pthread_t, (void));

#endif /* SPDK_INTERNAL_MOCK_H */
+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@

#include "spdk_internal/mock.h"

DEFINE_WRAPPER(calloc, void *, (size_t nmemb, size_t size), (nmemb, size), (void *)MOCK_PASS_THRU)

DEFINE_WRAPPER(pthread_mutex_init, int,
	       (pthread_mutex_t *mtx, const pthread_mutexattr_t *attr),
	       (mtx, attr), MOCK_PASS_THRU)
@@ -40,4 +42,4 @@ DEFINE_WRAPPER(pthread_mutex_init, int,
DEFINE_WRAPPER(pthread_mutexattr_init, int,
	       (pthread_mutexattr_t *attr), (attr), MOCK_PASS_THRU)

DEFINE_WRAPPER(calloc, void *, (size_t nmemb, size_t size), (nmemb, size), (void *)MOCK_PASS_THRU)
DEFINE_WRAPPER(pthread_self, pthread_t, (void), (), (pthread_t)MOCK_PASS_THRU)
+5 −2
Original line number Diff line number Diff line
@@ -30,5 +30,8 @@
#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
LDFLAGS += -Wl,--wrap,pthread_mutexattr_init -Wl,--wrap,pthread_mutex_init \
	   -Wl,--wrap,calloc
LDFLAGS += \
	-Wl,--wrap,calloc \
	-Wl,--wrap,pthread_mutexattr_init \
	-Wl,--wrap,pthread_mutex_init \
	-Wl,--wrap,pthread_self