aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am51
-rw-r--r--tests/mock_pam.c15
-rw-r--r--tests/mock_pam.h8
-rw-r--r--tests/test-x2go-wrapper.cc3
4 files changed, 60 insertions, 17 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a88cea8..34ba425 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,6 +13,11 @@ check_PROGRAMS = \
$(TESTS) \
$(NULL)
+CLEANFILES += \
+ test-x2go-auth \
+ $(TESTS) \
+ $(NULL)
+
AM_CPPFLAGS = $(GTEST_CPPFLAGS) \
$(REMOTE_APPS_MANAGER_CFLAGS) \
-I${top_srcdir}/src -Wall -Werror \
@@ -31,20 +36,41 @@ AM_CFLAGS = \
# Google Test Test Suite #
##########################
-check_LIBRARIES = libgtest.a
+check_LIBRARIES = libgtest.a libgtest_main.a
+
+gtest-all.cc:
+ cp $(GTEST_SOURCE)/src/gtest-all.cc .
+
+gtest_main.cc:
+ cp $(GTEST_SOURCE)/src/gtest_main.cc .
+
+CLEANFILES += \
+ gtest-all.cc \
+ gtest_main.cc \
+ $(NULL)
nodist_libgtest_a_SOURCES = \
- $(GTEST_SOURCE)/src/gtest-all.cc \
- $(GTEST_SOURCE)/src/gtest_main.cc \
+ gtest-all.cc \
+ $(NULL)
+nodist_libgtest_main_a_SOURCES = \
+ gtest_main.cc \
$(NULL)
libgtest_a_CPPFLAGS = \
$(GTEST_CPPFLAGS) -w \
$(AM_CPPFLAGS) \
$(NULL)
+libgtest_main_a_CPPFLAGS = \
+ $(GTEST_CPPFLAGS) -w \
+ $(AM_CPPFLAGS) \
+ $(NULL)
+
libgtest_a_CXXFLAGS = \
$(AM_CXXFLAGS) \
$(NULL)
+libgtest_main_a_CXXFLAGS = \
+ $(AM_CXXFLAGS) \
+ $(NULL)
##########################
# Wrapper
@@ -59,17 +85,29 @@ test_x2go_wrapper_SOURCES = \
$(NULL)
test_x2go_wrapper_LDADD = \
- $(top_builddir)/src/libssh.la \
- libgtest.a \
+ libgtest.a libgtest_main.a \
+ ${top_srcdir}/src/pam_x2go.la \
+ $(LIBSSH_LIBS) \
+ $(NULL)
+
+test_x2go_wrapper_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I${top_srcdir}/include \
+ -I${top_srcdir}/src \
+ $(GTEST_CPPFLAGS) \
+ $(LIBSSH_CPPFLAGS) \
$(NULL)
test_x2go_wrapper_CXXFLAGS = \
$(AM_CXXFLAGS) \
-DAUTH_CHECK="\"$(abs_builddir)/test-x2go-auth\"" \
- -I${top_srcdir}/src \
+ $(GTEST_CXXFLAGS) \
+ $(LIBSSH_CXXFLAGS) \
$(NULL)
test_x2go_wrapper_LDFLAGS = \
+ $(GTEST_LDFLAGS) \
+ $(LIBSSH_LDFLAGS) \
-pthread \
$(NULL)
@@ -80,4 +118,3 @@ test_x2go_wrapper_LDFLAGS = \
test_x2go_auth_SOURCES = \
test-x2go-auth.c \
$(NULL)
-
diff --git a/tests/mock_pam.c b/tests/mock_pam.c
index a07c9af..8b8e2f5 100644
--- a/tests/mock_pam.c
+++ b/tests/mock_pam.c
@@ -11,6 +11,7 @@
#include <string.h>
#include "mock_pam.h"
+#include "pam-x2go.h"
struct pam_handle {
void *item[PAM_NUM_ITEMS];
@@ -31,15 +32,15 @@ int fake_conv (int num_msg, const struct pam_message **msg,
response->resp_retcode = 0;
- if (strcmp((*msg)->msg, "login:") == 0)
+ if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_GUESTLOGIN) == 0)
response->resp = strdup ("guest"); /* IMPORTANT: this needs to be in /etc/passwd */
- else if (strcmp((*msg)->msg, "remote login:") == 0)
+ else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_USER) == 0)
response->resp = strdup ("ruser");
- else if (strcmp((*msg)->msg, "remote host:") == 0)
+ else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_HOST) == 0)
response->resp = strdup ("protocol://rhost/dummy");
- else if (strcmp((*msg)->msg, "password:") == 0)
+ else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_PASSWORD) == 0)
response->resp = strdup ("password");
- else if (strcmp((*msg)->msg, "remote command:") == 0)
+ else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_COMMAND) == 0)
response->resp = strdup ("rcommand");
else
return PAM_SYMBOL_ERR; /* leaks... */
@@ -63,7 +64,7 @@ pam_handle_t *pam_handle_new (void)
return newh;
}
-int pam_get_item (const pam_handle_t *pamh, int type, const void **value)
+int PAM_NONNULL((1)) pam_get_item (const pam_handle_t *pamh, int type, const void **value)
{
if (pamh == NULL)
return PAM_SYSTEM_ERR;
@@ -78,7 +79,7 @@ int pam_get_item (const pam_handle_t *pamh, int type, const void **value)
return PAM_SUCCESS;
}
-int pam_set_item (pam_handle_t *pamh, int type, const void *value)
+int PAM_NONNULL((1)) pam_set_item (pam_handle_t *pamh, int type, const void *value)
{
if (pamh == NULL)
return PAM_SYSTEM_ERR;
diff --git a/tests/mock_pam.h b/tests/mock_pam.h
index c335e49..01bea3f 100644
--- a/tests/mock_pam.h
+++ b/tests/mock_pam.h
@@ -10,6 +10,7 @@
#ifndef __MOCK_PAM_H__
#define __MOCK_PAM_H__
+#define LIBPAM_COMPILE
#include <security/pam_modules.h>
#include <security/pam_modutil.h>
#include <security/pam_appl.h>
@@ -19,7 +20,10 @@
typedef struct pam_handle pam_handle_t;
pam_handle_t *pam_handle_new (void);
-int pam_get_item (const pam_handle_t *pamh, int type, const void **value);
-int pam_set_item (pam_handle_t *pamh, int type, const void *value);
+
+int PAM_NONNULL((1))
+pam_get_item (const pam_handle_t *pamh, int type, const void **value);
+int PAM_NONNULL((1))
+pam_set_item (pam_handle_t *pamh, int type, const void *value);
#endif
diff --git a/tests/test-x2go-wrapper.cc b/tests/test-x2go-wrapper.cc
index a792d3e..f514f0f 100644
--- a/tests/test-x2go-wrapper.cc
+++ b/tests/test-x2go-wrapper.cc
@@ -13,10 +13,11 @@ extern "C" {
#include "mock_pam.h"
#include "mock_guest.h"
+#include "pam-x2go-private.h"
int x2goclient_wrapper (int argc, char * argv[]);
-const char * auth_check_path = AUTH_CHECK;
+ const char * auth_check_path = AUTH_CHECK;
}