1
+
2
+ ifeq ($(USE_REPO_TEST_DIR ) ,1)
3
+
4
+ # This rule replaces the whole Makefile when we're trying to use /tmp repository temporary files
5
+ location = $(CURDIR ) /$(word $(words $(MAKEFILE_LIST ) ) ,$(MAKEFILE_LIST ) )
6
+ self := $(location )
7
+
8
+ % :
9
+ @tmpdir=` mktemp --tmpdir -d` ; \
10
+ echo Using temporary directory $$ tmpdir for test repositories ; \
11
+ USE_REPO_TEST_DIR= $(MAKE ) -f $(self ) --no-print-directory REPO_TEST_DIR=$$ tmpdir/ $@ ; \
12
+ STATUS=$$? ; rm -r " $$ tmpdir" ; exit $$ STATUS
13
+
14
+ else
15
+
16
+ # This is the "normal" part of the Makefile
17
+
1
18
DIST := dist
2
19
DIST_DIRS := $(DIST ) /binaries $(DIST ) /release
3
20
IMPORT := code.gitea.io/gitea
@@ -321,23 +338,28 @@ test-vendor: vendor
321
338
exit 1; \
322
339
fi ;
323
340
341
+ generate-ini-sqlite :
342
+ sed -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
343
+ integrations/sqlite.ini.tmpl > integrations/sqlite.ini
344
+
324
345
.PHONY : test-sqlite
325
- test-sqlite : integrations.sqlite.test
346
+ test-sqlite : integrations.sqlite.test generate-ini-sqlite
326
347
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
327
348
328
349
.PHONY : test-sqlite\# %
329
- test-sqlite\#% : integrations.sqlite.test
350
+ test-sqlite\#% : integrations.sqlite.test generate-ini-sqlite
330
351
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $(subst .,/,$* )
331
352
332
353
.PHONY : test-sqlite-migration
333
- test-sqlite-migration : migrations.sqlite.test
354
+ test-sqlite-migration : migrations.sqlite.test generate-ini-sqlite
334
355
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
335
356
336
357
generate-ini-mysql :
337
358
sed -e ' s|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
338
359
-e ' s|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
339
360
-e ' s|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
340
361
-e ' s|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
362
+ -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
341
363
integrations/mysql.ini.tmpl > integrations/mysql.ini
342
364
343
365
.PHONY : test-mysql
@@ -357,6 +379,7 @@ generate-ini-mysql8:
357
379
-e ' s|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
358
380
-e ' s|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
359
381
-e ' s|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
382
+ -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
360
383
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
361
384
362
385
.PHONY : test-mysql8
@@ -377,6 +400,7 @@ generate-ini-pgsql:
377
400
-e ' s|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
378
401
-e ' s|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
379
402
-e ' s|{{TEST_PGSQL_SCHEMA}}|${TEST_PGSQL_SCHEMA}|g' \
403
+ -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
380
404
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
381
405
382
406
.PHONY : test-pgsql
@@ -396,6 +420,7 @@ generate-ini-mssql:
396
420
-e ' s|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
397
421
-e ' s|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
398
422
-e ' s|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
423
+ -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
399
424
integrations/mssql.ini.tmpl > integrations/mssql.ini
400
425
401
426
.PHONY : test-mssql
@@ -411,7 +436,7 @@ test-mssql-migration: migrations.mssql.test generate-ini-mssql
411
436
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.mssql.test
412
437
413
438
.PHONY : bench-sqlite
414
- bench-sqlite : integrations.sqlite.test
439
+ bench-sqlite : integrations.sqlite.test generate-ini-sqlite
415
440
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
416
441
417
442
.PHONY : bench-mysql
@@ -627,3 +652,6 @@ golangci-lint:
627
652
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH ) /bin v1.24.0; \
628
653
fi
629
654
golangci-lint run --timeout 5m
655
+
656
+ # This endif closes the if at the top of the file
657
+ endif
0 commit comments