From 42d0c4c040e83fe512f3985d8a71825cbdfd2d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 28 Nov 2019 19:56:49 +0100 Subject: [PATCH] Remove unused makefile scripts --- Makefile | 53 ---------------- configure | 81 ------------------------ docker-bash.sh | 13 ---- docker-test.sh | 4 -- package.json | 2 +- run_tests.sh | 149 -------------------------------------------- run_tests_docker.sh | 22 ------- 7 files changed, 1 insertion(+), 323 deletions(-) delete mode 100644 Makefile delete mode 100755 configure delete mode 100755 docker-bash.sh delete mode 100755 docker-test.sh delete mode 100755 run_tests.sh delete mode 100644 run_tests_docker.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index 23554888..00000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -SHELL=/bin/bash - -pre-install: - @$(SHELL) ./scripts/check-node-canvas.sh - -all: - @$(SHELL) ./scripts/install.sh - -clean: - rm -rf node_modules/ - -distclean: clean - rm config.status* - -config.status--test: - ./configure --environment=test - -config/environments/test.js: config.status--test - ./config.status--test - -TEST_SUITE := $(shell find test/{acceptance,integration,unit} -name "*.js") -TEST_SUITE_UNIT := $(shell find test/unit -name "*.js") -TEST_SUITE_INTEGRATION := $(shell find test/integration -name "*.js") -TEST_SUITE_ACCEPTANCE := $(shell find test/acceptance -name "*.js") - -test: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE) - -test-unit: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_UNIT) - -test-integration: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_INTEGRATION) - -test-acceptance: config/environments/test.js - @echo "***tests***" - @$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_ACCEPTANCE) - -lint: - @echo "***eslint***" - @./node_modules/.bin/eslint app.js "lib/**/*.js" "test/**/*.js" - -test-all: test lint - -coverage: - @RUNTESTFLAGS=--with-coverage make test - -check: test - -.PHONY: pre-install test lint coverage diff --git a/configure b/configure deleted file mode 100755 index c234f6f4..00000000 --- a/configure +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# -# This script creates config/environments/*.js files using -# config/environments/*.js.example files as input and performing -# settings substitutions. -# -# It relies on a known format of the .js.example files which haven't -# been made easier to parse to still let humans copy them manually and -# do further editing or leave them as such to get the same setup as before -# the introduction of this script. -# -# The script is a work in progress. Available switches are printed -# by invoking with the --help switch. More switches will be added -# as the need/request for them arises. -# -# --strk(2012-07-23) -# - -ENVDIR=config/environments - -PGPORT= -MAPNIK_VERSION= -ENVIRONMENT=development - -STATUS="$0 $*" - -usage() { - echo "Usage: $0 [OPTION]" - echo - echo "Configuration:" - echo " --help display this help and exit" - echo " --with-pgport=NUM access PostgreSQL server on TCP port NUM [$PGPORT]" - echo " --with-mapnik-version=STRING set mapnik version string [$MAPNIK_VERSION]" - echo " --environment=STRING set output environment name [$ENVIRONMENT]" -} - -while test -n "$1"; do - case "$1" in - --help|-h) - usage - exit 0 - ;; - --with-pgport=*) - PGPORT=`echo "$1" | cut -d= -f2` - ;; - --with-mapnik-version=*) - MAPNIK_VERSION=`echo "$1" | cut -d= -f2` - ;; - --environment=*) - ENVIRONMENT=`echo "$1" | cut -d= -f2` - ;; - *) - echo "Unused option '$1'" >&2 - ;; - esac - shift -done - -ENVEX=./${ENVDIR}/${ENVIRONMENT}.js.example - -if [ -z "$PGPORT" ]; then - PGPORT=`node -e "console.log(require('${ENVEX}').postgres.port)"` -fi - -echo "PGPORT: $PGPORT" -echo "MAPNIK_VERSION: $MAPNIK_VERSION" -echo "ENVIRONMENT: $ENVIRONMENT" - -o=`dirname "${ENVEX}"`/`basename "${ENVEX}" .example` -echo "Writing $o" - -# See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/ -sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "${ENVEX}" \ - | sed "s/mapnik_version:.*/mapnik_version: '$MAPNIK_VERSION'/" \ - > "$o" - -STATUSFILE=config.status--${ENVIRONMENT} -echo "Writing ${STATUSFILE}" -echo ${STATUS} > ${STATUSFILE} && chmod +x ${STATUSFILE} - diff --git a/docker-bash.sh b/docker-bash.sh deleted file mode 100755 index 5666ea1d..00000000 --- a/docker-bash.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo "*********************" -echo "To install Node.js, run:" -echo "/src/nodejs-install.sh" -echo "Use NODEJS_VERSION env var to select the Node.js version" -echo " " -echo "To start postgres, run:" -echo "/etc/init.d/postgresql start" -echo "*********************" -echo " " - -docker run -it -v `pwd`:/srv carto/nodejs-xenial-pg101:latest bash diff --git a/docker-test.sh b/docker-test.sh deleted file mode 100755 index bca2c5db..00000000 --- a/docker-test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -docker run -e "NODEJS_VERSION=${2}" -v `pwd`:/srv ${1} bash run_tests_docker.sh && \ - docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v diff --git a/package.json b/package.json index 67101497..ce9a08bd 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "scripts": { "lint:fix": "eslint --fix app.js \"lib/**/*.js\" \"test/**/*.js\"", "lint": "eslint app.js \"lib/**/*.js\" \"test/**/*.js\"", - "preinstall": "make pre-install", + "preinstall": "./scripts/check-node-canvas.sh", "pretest:setup": "npm run lint", "test:setup": "NODE_ENV=test node test setup", "pretest": "npm run test:setup", diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index 9686687f..00000000 --- a/run_tests.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -OPT_CREATE_REDIS=yes # create the redis test environment -OPT_CREATE_PGSQL=yes # create the PostgreSQL test environment -OPT_DROP_REDIS=yes # drop the redis test environment -OPT_DROP_PGSQL=yes # drop the PostgreSQL test environment -OPT_COVERAGE=no # run tests with coverage -OPT_REDIS_CELL=yes # download redis cell - -export PGAPPNAME=cartodb_tiler_tester - -cd $(dirname $0) -BASEDIR=$(pwd) -cd - - -REDIS_PORT=`node -e "console.log(require('${BASEDIR}/config/environments/test.js').redis.port)"` -export REDIS_PORT - -cleanup() { - if test x"$OPT_DROP_REDIS" = xyes; then - if test x"$PID_REDIS" = x; then - PID_REDIS=$(cat ${BASEDIR}/redis.pid) - if test x"$PID_REDIS" = x; then - echo "Could not find a test redis pid to kill it" - return; - fi - fi - redis-cli -p ${REDIS_PORT} info stats - redis-cli -p ${REDIS_PORT} info keyspace - echo "Killing test redis pid ${PID_REDIS}" - #kill ${PID_REDIS_MONITOR} - kill ${PID_REDIS} - fi - if test x"$OPT_DROP_PGSQL" = xyes; then - # TODO: drop postgresql ? - echo "Dropping PostgreSQL test database isn't implemented yet" - fi -} - -cleanup_and_exit() { - cleanup - exit -} - -die() { - msg=$1 - echo "${msg}" >&2 - cleanup - exit 1 -} - -trap 'cleanup_and_exit' 1 2 3 5 9 13 - -while [ -n "$1" ]; do - # This is kept for backward compatibility - if test "$1" = "--nodrop"; then - OPT_DROP_REDIS=no - OPT_DROP_PGSQL=no - shift - continue - elif test "$1" = "--nodrop-pg"; then - OPT_DROP_PGSQL=no - shift - continue - elif test "$1" = "--nodrop-redis"; then - OPT_DROP_REDIS=no - shift - continue - elif test "$1" = "--nocreate-pg"; then - OPT_CREATE_PGSQL=no - shift - continue - elif test "$1" = "--nocreate-redis"; then - OPT_CREATE_REDIS=no - shift - continue - elif test "$1" = "--with-coverage"; then - OPT_COVERAGE=yes - shift - continue - # This is kept for backward compatibility - elif test "$1" = "--nocreate"; then - OPT_CREATE_REDIS=no - OPT_CREATE_PGSQL=no - shift - continue - elif test "$1" = "--norediscell"; then - OPT_REDIS_CELL=no - shift - continue - else - break - fi -done - -if [ -z "$1" ]; then - echo "Usage: $0 [] []" >&2 - echo "Options:" >&2 - echo " --nocreate do not create the test environment on start" >&2 - echo " --nodrop do not drop the test environment on exit" >&2 - echo " --with-coverage use istanbul to determine code coverage" >&2 - echo " --norediscell do not download redis-cell" >&2 - exit 1 -fi - -TESTS=$@ - -if test x"$OPT_CREATE_REDIS" = xyes; then - echo "Starting redis on port ${REDIS_PORT}" - REDIS_CELL_PATH="${BASEDIR}/test/support/libredis_cell.so" - if [[ "$OSTYPE" == "darwin"* ]]; then - REDIS_CELL_PATH="${BASEDIR}/test/support/libredis_cell.dylib" - fi - - echo "port ${REDIS_PORT}" | redis-server - --loadmodule ${REDIS_CELL_PATH} > ${BASEDIR}/test.log & - PID_REDIS=$! - echo ${PID_REDIS} > ${BASEDIR}/redis.pid -fi - -PREPARE_DB_OPTS= -if test x"$OPT_CREATE_PGSQL" != xyes; then - PREPARE_DB_OPTS="$PREPARE_DB_OPTS --skip-pg" -fi -if test x"$OPT_CREATE_REDIS" != xyes; then - PREPARE_DB_OPTS="$PREPARE_DB_OPTS --skip-redis" -fi - -echo "Preparing the environment" -cd ${BASEDIR}/test/support -source prepare_db.sh "${PREPARE_DB_OPTS}" || die "database preparation failure" -cd - - -PATH=node_modules/.bin/:$PATH - -#redis-cli -p ${REDIS_PORT} monitor > /tmp/windshaft-cartodb.redis.log & -#PID_REDIS_MONITOR=$! - -if test x"$OPT_COVERAGE" = xyes; then - echo "Running tests with coverage" - ./node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -u tdd -t 5000 --exit ${TESTS} -else - echo "Running tests" - ./node_modules/.bin/_mocha -c -u tdd -t 5000 --exit ${TESTS} -fi -ret=$? - -cleanup - -exit $ret diff --git a/run_tests_docker.sh b/run_tests_docker.sh deleted file mode 100644 index f30a39d3..00000000 --- a/run_tests_docker.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -/etc/init.d/postgresql start - -source /src/nodejs-install.sh - -# Install cartodb-postgresql extension -git clone https://github.com/CartoDB/cartodb-postgresql.git -cd cartodb-postgresql && make && make install && cd .. - -echo "Node.js version: " -node -v - -echo "npm version: " -npm -v - -echo "Clean install: " -npm ci -npm ls - -# run tests -npm test