Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
tools/README The tool directory contains several tools that may be essential or useful in E-Maj development: - regress.sh is a shell script that select and execute regression tests, - copy2Expected.sh is a shell script that copy the result files of regression tests environment to the reference directory, - check_code.pl is a perl script that performs various checks on the script that creates the emaj extension, - sync_fct_in_upgrade_script.pl is a perl script that generates the functions part of the upgrade scripts. regress.sh ---------- The regress.sh script is the key tool to perform regression tests. It executes scenarios located into the test directory. These scenarios use sql scripts located into the test/sql directory. The output files are stored into the test/<pg_version>/results directory and compared with reference files located into the test/<pg_version>/expected directory. Several types of tests are available: - the standard set of tests starting with the emaj installation, - a dump of an emaj environment from a cluster in one postgres version and a restore in another cluster running another postgres version, - the standard set of tests starting with the installation of the prior emaj version followed by the migration script, - some specific tests including an emaj version migration in the middle of the operations. To complete the standart tests scenarios, a test of the parallel rollback client is run. Customisation: First, some symbolic links must be created so that the unique test/sql directory can be used for all postgres version test environment. To do this, just issue for each postgres version the following command: ln -s test/sql test/<pg_version>/sql Similarly, a symbolic link has to be created to reach the emaj.sql script: ln -s sql/emaj.sql test/sql/emaj.sql Then the regress.sh script must be adapted. At the beginning of the script (near line 8), the variable EMAJ_HOME is initialized with the emaj project root directory. Then, for each installed postgres version, 3 variables are initialized: - PGBIN<version> is the postgres binary path - PGPORT<version> is the ip port of the cluster running this postgres version - PGREG<version> points to the directory that hosts the standart regress tool You must adapt these values to fit your installation. At the end of the script, a menu is displayed to propose all available tests. You must adapt it to your environment. copy2Expected.sh ---------------- The copy2Expected.sh is a shell script that copy the result files of regression tests environment to the reference directory. Once result regression test files are considered as representing a new reference, you can simply execute the script by typing: sh copy2Expected.sh Customisation: At the beginning of the script (near line 7), the variable EMAJ_HOME is initialized with the emaj project root directory. You must adapt its value to fit your installation. Then for each available major postgres version on the environment, 2 commands copy the ouput test files from the /results to the /expected directories. You must adapt the script to your installed major postgres versions. check_code.pl ------------- The check_code.pl is a perl script that performs various checks on the script that creates the emaj extension. It detects unused variables in plpgsql functions. It checks the format of lines and reports tab characters or trailing spaces. Customisation: Line 29 and 30, two variables set the pathname of the source script to analyze. sync_fct_in_upgrade_script.pl ----------------------------- The sync_fct_in_upgrade_script.pl perl script generates the functions part of the upgrade scripts. It compares the installation scripts of the previous and the current E-Maj versions and deducts the functions to drop and the functions to create in the related upgrade script. In the upgrade script, it keeps the sections related to other objetcs (tables, types, grants,...), two predefined patterns delimiting the functions section. Customisation: Line 19 to 21, three variables set the absolute pathname of the scripts to process: the script of the current version (variable $ficCurrSrc), the script of the previous version ($ficPrevSrc) and the already existing upgrade script (variable $ficUpgrade). The script has to be adjusted at each upgrade.