COMP9315 Page 1 of 3 COMP9315 25T1: Assignment 1 Testing Instruction This document describes a testing framework for determining whether your implement -tation of the PostAddress data type is correct. This testing framework contains a subset of the tests that will be made in auto-marking. If you pass all the tests here, you ought to pass the majority of the auto-marking tests. The first step in setting up the testing framework is to make a testing directory under your vxdb01 local storage: $ ssh vxdb01 $ source /localstorage/$USER/env $ p1 ... start your database server ... $ mkdir /localstorage/$USER/testing The next step is to set up the testing infrastructure: $ cd /localstorage/$USER/ $ tar -xf /web/cs9315/25T1/assignments/ass1/testing/testing.tar This sets up a number of files and directories under the testing directory. Note that some of these are actually symbolic links to our files so that (a) you can't change them, and (b) you save storage space under your own directory. The tar command creates (among other things) the following: • run_test.py a Python script that will run all of the tests; use this after you have gotten your implementation of PostAddress into a reasonable state; this is a symlink to a script in the COMP9315 account. • a tests/ subdirectory, containing all of the test files; 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. COMP9315 Page 2 of 3 There are two schemas provided with the testing framework, and each schema has corresponding data sets. Locations(lid::int, postadd:: PostAddress); Students(id::int, name::text, postadd::PostAddress, program::int, plan::char[6]); Under tests/, you will find three subdirectories: ❖ Sanity_checks Doesn't contain data to be stored. Assumes that you have an (empty) database with a PostAddress data type loaded and allows you to run a bunch of simple checks on values of type PostAddress. Useful for testing your parsing function postadd_in(), your output function postadd_out and your operators. ❖ Locations Contains a schema and database for a table with just one attribute of type PostAddress. There are two 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. ❖ Student_info Contains a schema for a table of student data. There are three data files ranging in size from 100 tuples to 10000 tuples; each data file is a superset of the preceding data file. The queries test a wide range of PostAddress functionality, including indexing. You should definitely check whether your code can deal with data3.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 postadd.c and postadd.source files into the new testing directory. COMP9315 Page 3 of 3 ... this assume your files are in /localstorage/$USER/postgresql-15.11/src/tutorial/ ... ... if they are somewhere else copy from that location instead ... $ cp postgresql-15.11/src/tutorial/postadd.c testing/postadd.c $ cp postgresql-15.11/src/tutorial/postadd.source testing/postadd.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-15.11/src/tutor ial/ directory. You can now run the tests. $ cd /localstorage/$USER/testing ... edit your .c and .source files ... $ make $ python3 run_test.py ... internal logs from postgre sql 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 ... NOTES: • postadd.source should do the bare minimum needed to create the PostAddress type as specified. • postadd.source should not try to create any tables, insert any data, or drop the PostAddress type. • Everything done in postadd.source should be undo-able with "DROP TYPE PostAddress CASCADE". • These tests remove some information like timing, paths, and width from output to allow for comparison to expected 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. • Plagiarism checking will be conducted in marking. Please report any issues ASAP on the Ed forum for this page.
学霸联盟