COMP9315 20T1
Assignment 1
Testing Resources
DBMS Implementation
Last updated: Monday 9th March 11:53am
Most recent changes are shown in red;
older changes are shown in brown.
UPDATE: run_test.py has been updated as of 9th March 0:00:00
If you are woking from home redownload the tar file fom the link below
If you are working on grieg run:
$ cp -P /web/cs9315/20T1/assignments/ass1/testing/run_test.py /srvr/$USER/testing/run_test.py
The provided files contain material to assist you in testing your PersonName data type.
Currently there are three provided schemas
Users(realname::PersonName)
Students(id::int, name::PersonName, program::int, plan::char[6])
Students(id::int, name::text, program::int, plan::char[6])
To run tests on your PersonName type, get the test files from the archive provided.
$ ssh grieg
$ source /srvr/$USER/env
$ cd /srvr/$USER
$ tar -xf /web/cs9315/20T1/assignments/ass1/testing/testing.tar
The above tar command creates a subdirectory called tests/ in your testing/ directory. This is a symlink to files under the COMP9315 account, so all of the tests are read-only unless you copy them manually to your testing/ directory. Under tests/, you will find three subdirectories:
0_sanity-checks
Doesn’t contain data to be stored. Assumes that you have an (empty) database with a PersonName data type loaded, and allows you to run a bunch of simple checks on values of type PersonName. Useful for testing your parsing function pname_in(), your output function pname_out and your operators.
1_users
Contains a schema and database for a table with just one attribute of type PersonName. There are three data files of differing sizes. You should create a new database, add the schema and then insert the data from one data file. There are a series of tests to check whether all of the data was loaded and can be manipulted correctly.
2_students
Contains a schema for a table of student data. There are four data files ranging in size from 100 tuples to 100000 tuples; each data file is a superset of the preceding data file. The queries test a wide range of PersonName functionality, including indexing. You should definitely check whether your code can deal with data4.sql; some bugs don’t manifest themselves until you try with large amounts of data.
You can look at the tests in these directories and copy-paste them into a psql session if you want to perform individual tests. Or you can run a comprehensive set of tests using the Python script described below. Each directory contains an info.txt file giving more details about the files in the directory.
Next, you should move your pname.c and pname.source files into the new testing directory.
… this is the probable location that your files are in …
… if they are somewhere else copy from that location instead …
$ cp postgresql-12.1/src/tutorial/pname.c testing/pname.c
$ cp postgresql-12.1/src/tutorial/pname.source testing/pname.source
From this point on, you can do your assignment development in the testing/ directory. The provided Makefile will do the same job as the one in the postgresql-12.1/src/tutorial/ directory. Don’t forget to run the command:
$ source /srvr/$USER/env
every time you want to do a development/debugging session on your PersonName data type.
You can now run the tests.
$ ssh grieg
$ source /srvr/$USER/env
$ cd /srvr/$USER/testing
$ ./run_test.py
… internal logs from postgresql are placed in pg.log …
… external logs from the testing script are placed in test.log …
… start by reading test.log after run_test.py has finished …
You can download and run the tests at home with this link (WARNING: contains a very large file)
But you will need to edit run_tests.py and remove the check that you are on grieg:
comment out lines 14-23.
NOTES:
• pname.source should do the bare minimum needed to create the PersonName type as specified.
• pname.source should not try to create any tables, insert any data, or drop the PersonName type.
• Everything done in pname.source should be undo-able with “DROP TYPE PersonName CASCADE”.
• These tests remove some information like timing, paths, and width from output to allow for comparison to expexted output.
• Do your own tests, especially to make sure that queries are completed in a reasonable time and you are storing data in a reasonable amount of space.
Please report any issues ASAP on the Webcms3 comments for this page.
Have fun, jas and dylan