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: Jim Harris <james.r.harris@intel.com>
Change-Id: I559cd1fd79e78f03ebdac313e0bbedbcdde4a8c1

Reviewed-on: https://review.gerrithub.io/377968
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Jim Harris 2017-09-11 09:10:33 -07:00 committed by Daniel Verkamp
parent 76774528be
commit 19de08066d
3 changed files with 10 additions and 3 deletions

View File

@ -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 */

View File

@ -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)

View File

@ -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