diff --git a/Makefile b/Makefile index 2551cb52..b513714b 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,23 @@ misspell-check: fi misspell -error -i unknwon,destory $(GOFILES) +.PHONY: install-instant-client +install-instant-client: +ifeq ("$(PKG_CONFIG_PATH)", ) + wget https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip + unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip -d /usr/local/instantclient + echo "prefixdir=/usr/local/instantclient +libdir=${prefixdir} +includedir=${prefixdir}/sdk/include + +Name: OCI +Description: Oracle database driver +Version: 11.2 +Libs: -L${libdir} -lclntsh +Cflags: -I${includedir}" > /usr/local/instantclient/oci8.pc +export PKG_CONFIG_PATH=/usr/local/instantclient/oci8.pc +endif + .PHONY: test test: go-check $(GO) test $(PACKAGES) @@ -186,25 +203,25 @@ test-mysql\#%: go-check test-oracle: test-godror .PNONY: test-oci8 -test-oci8: go-check +test-oci8: go-check install-instant-client $(GO) test $(INTEGRATION_PACKAGES) -v -race -tags=oracle -db=oci8 -schema='$(TEST_ORACLE_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \ -conn_str="$(TEST_ORACLE_USERNAME):$(TEST_ORACLE_PASSWORD)@$(TEST_ORACLE_HOST)/$(TEST_ORACLE_DBNAME)" \ -coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic .PHONY: test-oci8\#% -test-oci8\#%: go-check +test-oci8\#%: go-check install-instant-client $(GO) test $(INTEGRATION_PACKAGES) -v -race -run $* -tags=oracle -db=oci8 -schema='$(TEST_PGSQL_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \ -conn_str="postgres://$(TEST_PGSQL_USERNAME):$(TEST_PGSQL_PASSWORD)@$(TEST_PGSQL_HOST)/$(TEST_PGSQL_DBNAME)" \ -coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic .PHONY: test-godror -test-godror: go-check +test-godror: go-check install-instant-client $(GO) test $(INTEGRATION_PACKAGES) -v -race -tags=oracle -db=godror -schema='$(TEST_ORACLE_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \ -conn_str="oracle://$(TEST_ORACLE_USERNAME):$(TEST_ORACLE_PASSWORD)@$(TEST_ORACLE_HOST)/$(TEST_ORACLE_DBNAME)" \ -coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic .PHONY: test-godror\#% -test-godror\#%: go-check +test-godror\#%: go-check install-instant-client $(GO) test $(INTEGRATION_PACKAGES) -v -race -run $* -tags=oracle -db=godror -schema='$(TEST_ORACLE_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \ -conn_str="oracle://$(TEST_ORACLE_USERNAME):$(TEST_ORACLE_PASSWORD)@$(TEST_ORACLE_HOST)/$(TEST_ORACLE_DBNAME)" \ -coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic