From a7f0fae6ab8fe6aa5f30f1cb072b96907ec77eaf Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 29 Sep 2011 10:42:23 +0200 Subject: [PATCH] Bug #12373393 PB2 SHOULD ALLOW TO CREATE COLLECTIONS AS SUPER SET OF EXISTING COLLECTIONS Let CMake parse files with a ".in" suffix containing includes Added default.release.in to replace default.release Explained in README New patch: replace 'include' with '#include' to avoid accidental matches --- .bzrignore | 1 + mysql-test/CMakeLists.txt | 23 +++++++++++++++++++ mysql-test/collections/README | 8 +++++++ .../{default.release => default.release.in} | 6 +++++ 4 files changed, 38 insertions(+) rename mysql-test/collections/{default.release => default.release.in} (91%) diff --git a/.bzrignore b/.bzrignore index 017c41f2188..36bb062ffff 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1314,6 +1314,7 @@ mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz mysql-test/*.ds? mysql-test/*.vcproj mysql-test/.DS_Store +mysql-test/collections/default.release mysql-test/funcs_1.log mysql-test/funcs_1.tar mysql-test/gmon.out diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 655d8e086eb..954e9c44311 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -132,3 +132,26 @@ ADD_CUSTOM_TARGET(test-bt-debug COMMAND ${MTR_FORCE} --comment=debug --timer --skip-ndbcluster --skip-rpl --report-features ${EXP} ) +# Process .in files with includes in collections/ + +MACRO(PROCESS_COLLECTION_INCLUDE collin collection) + FILE(STRINGS ${collin} inlines) + FOREACH(line ${inlines}) + IF(${line} MATCHES "#include .*") + STRING(REPLACE "#include " "collections/" incfile ${line}) + FILE(READ ${incfile} contents) + FILE(APPEND ${collection} "${contents}") + ELSE() + FILE(APPEND ${collection} "${line}\n") + ENDIF() + ENDFOREACH() +ENDMACRO() + +FILE(GLOB infiles "collections/*.in") +FOREACH(collin ${infiles}) + STRING(REPLACE ".in" "" collection ${collin}) + # Only generate file once + IF(NOT EXISTS ${collection}) + PROCESS_COLLECTION_INCLUDE(${collin} ${collection}) + ENDIF() +ENDFOREACH() diff --git a/mysql-test/collections/README b/mysql-test/collections/README index 9af84646a40..f64c089ee99 100644 --- a/mysql-test/collections/README +++ b/mysql-test/collections/README @@ -28,3 +28,11 @@ these steps: 5) The commands from the collection are run line by line via execv() or similar system calls. They are not run as a shell script. Shell expansions are not guaranteed to work and most likely won't. + +The directory may contain collections that are "super sets" of others, +identified by a file name suffix ".in". These files may contain lines +"#include ", or lines with mysql-test-run.pl invocations. +CMake will create a new file without the .in suffix where +the include lines are replaced with the contents of the referred +file. Filename is local to the collections directory, and includes do +not nest. diff --git a/mysql-test/collections/default.release b/mysql-test/collections/default.release.in similarity index 91% rename from mysql-test/collections/default.release rename to mysql-test/collections/default.release.in index 108e1032ca2..0e3ad30671b 100644 --- a/mysql-test/collections/default.release +++ b/mysql-test/collections/default.release.in @@ -1,3 +1,9 @@ +# This file contains the old default.release, the plan is to replace that +# with something like the below (remove space after #): + +# include default.daily +# include default.weekly + perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-ndbcluster --skip-rpl --report-features --debug-server perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --skip-ndbcluster --report-features perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --skip-ndbcluster --ps-protocol