summaryrefslogtreecommitdiff
path: root/packages/google-compute-engine-oslogin/test/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'packages/google-compute-engine-oslogin/test/Makefile')
-rw-r--r--packages/google-compute-engine-oslogin/test/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/packages/google-compute-engine-oslogin/test/Makefile b/packages/google-compute-engine-oslogin/test/Makefile
new file mode 100644
index 0000000..83d23fd
--- /dev/null
+++ b/packages/google-compute-engine-oslogin/test/Makefile
@@ -0,0 +1,34 @@
+TOPDIR = $(realpath ..)
+
+CPPFLAGS += -I$(TOPDIR)/src/include -I/usr/include/json-c
+CXXFLAGS += -g -Wall -Wextra -std=c++11
+LDLIBS = -lcurl -ljson-c -lpthread
+
+all : test_runner non_network_tests
+
+clean :
+ rm -f test_runner *.o
+
+gtest-all.o : $(GTEST_DIR)/src/gtest-all.cc
+ $(CXX) $(CXXFLAGS) -isystem $(GTEST)/include -I$(GTEST) $(CPPFLAGS) -c $^
+
+test_runner : oslogin_utils_test.o $(TOPDIR)/src/utils.o gtest-all.o
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ -o $@ $(LDLIBS)
+
+non_network_tests : test_runner
+ ./test_runner --gtest_filter=*-FindGroupTest.*:GetUsersForGroupTest.*
+
+network_tests : test_runner ping reset
+ ./test_runner --gtest_filter=FindGroupTest.*:GetUsersForGroupTest.*
+
+# run as $ make tests GTESTARGS="--gtest_filter=FindGroupTest.*"
+tests : test_runner
+ ./test_runner ${GTESTARGS}
+
+ping :
+ nc -vzw2 metadata.google.internal 80 >/dev/null 2>&1
+
+reset :
+ curl -Ss http://metadata.google.internal/reset >/dev/null 2>&1
+
+.PHONY : all clean tests ping reset gtest prowtest