Testing - SCECcode/ucvm GitHub Wiki

Overview of UCVM Testing

Several variety of tests have been implemented to ensure proper operation of UCVM.

  • Unit Tests
  • Acceptance Tests
  • CI Tests
  • Model specific Tests

UCVM C-Language Testing Fixtures

  • C-Language - unittest - C executable
  • accepttest - C executable

UCVM uses two C language programs called unittest.c and accepttest.c framework. These C program framework provides methods like "test_assert_string()". There are references to an xmldir with list of tests, but that is not used. These C language tests enable us to test the C-API for UCVM

Test defined as C lanuage functions in accepttest_suite_grid.c

  • test_grid_tool_1d()
  • test_grid_lib_1d()
  • then suite_xxx() where test_grid_tool_1d is tested with its own script

UCVM Python Language Testing

UCVM uses a custom script accept_test.py. Contains two tests:

  • def test_vs30_query(dir)
  • def test_ssh_generate(dir):

UCVM Test Scripts

make check - defined in ucvm_bin/tests

  • runs unittest
  • runs accepttest
  • runs accept_test.py

Makefile.am creates script > run-testing

  • unittest
  • accepttest
  • accept_test.py
  • cd api; ./run_query_1d_gtl.sh
  • cd basin; ./run_basin_query_mpi_cvms5.sh
  • cd mesh; ./run_ucvm2mesh_mpi_layer_cvms.sh

Manifest of UCVM Programs and Scripts Requiring Tests

  • Programs in UCVM bin directory:
  • ssh_generate
  • ssh_merge
  • vs30_query
  • vs30_query_mpi
  • basin_query
  • basin_query_mpi
  • basin_query_mpi_complete
  • ecoalesce
  • ecompact
  • grd2etree
  • grd_query
  • mesh_check
  • mesh_op
  • mesh_strip_ijk
  • patchmodel
  • ucvm2mesh
  • ucvm2mesh_mpi
  • ucvm2mesh_mpi_layer
  • ucvm2etree
  • ucvm2etree_extract_MPI
  • ucvm2etree_merge_MPI
  • ucvm2etree_sort_MPI
  • ucvm_query

Programs in Utilities Directory:

  • installed_models.py
  • makegrid.sh
  • run_ucvm_query.sh
  • run_ucvm.sh
  • time_mesh_generation.py
  • view_png.py

Test programs:

  • unittest
  • accepttest
  • accept_test.py
  • api/query_1d_gtl
  • api/run_query_1d_gtl.sh
  • basin/run_basin_query_mpi_cvms5.sh -> tests basin_query_mpi
  • mesh/ucvm2mesh_mpi_layer
  • mesh/run_ucvm2mesh_mpi_layer_cvms.sh

Core UCVM C-language tests - Unittests

Tests for adding Models to UCVM. These also confirm path to UCVM models set correctly. Test defined as c language functions in unittest_suite_lib.c. This c-language program imports ucvm.h and then calls the UCVM API from C language program. The inputs and expected results for several of the tests are hard-coded in the C source code files.

  • test_lib_init()
  • test_lib_add_model_1d()
  • test_lib_query_1d()
  • test_lib_get_model_label_1d()
  • test_lib_setparam_querymode_gd_1d()
  • test_lib_setparam_querymode_ge_1d
  • test_lib_model_version_1d

Following Tests have conditional compile statements in unittest.c

  • test_lib_add_model_cencal
  • test_lib_add_model_cvmh
  • test_lib_add_model_cvms
  • test_lib_add_model_cvmsi
  • test_lib_add_model_ivlsu
  • test_lib_add_model_cvlsu
  • test_lib_add_model_albacore
  • test_lib_add_model_cvms5
  • test_lib_add_model_cca
  • test_lib_add_model_cs173
  • test_lib_add_model_cs173h

Tests for Query by Elevation/Query by Depth

  • int test_lib_setparam_querymode_gd_1d()
  • int test_lib_setparam_querymode_ge_1d()

Core Capabilities Requiring Tests

Additional Key Core Functionality

  • Test case interpolation
  • Test Cases Tiling
  • Test Cases Invalid Point
  • ucvm_query
  • basin_query

Test Changes

These tests need to be migrated to unittest_suite_lib.c

  • Adding Elygtl:ifunc
  • accepttest_suite_grid.c:int test_grid_tool_1d()
  • accepttest_suite_grid.c:int test_grid_lib_1d()

These tests need to be migrated to standard python test framework

  • accept_test.py:def test_vs30_query(dir):
  • accept_test.py:def test_ssh_generate(dir):

Planned UCVM Test cases

This entry defines test cases used to document performance of the UCVMC v17.1 release.

Test Case ucvm2mesh and ucvm2mesh-mpi tests

The goal of this test is to construct AWP test meshes using both ucvm2mesh and ucvm2mesh-mpi. *Test that shows equivalent input files for ucvm2mesh and ucvm2mesh-mpi. Also includes the job submit script for mpi job, and defines the restrictions on number of nodes. *Test that shows the mesh values returned by these methods are identical. *Test that shows plots of output meshes, using mesh plotting utilities from scott described below. *Test that shows cross section plots from model and from mesh for same region. *Update ucvmc Installation instructions need to be updated to describe how to create mpi version if running on usc hpc.

Test Case for basin_query serial and mpi tests

The goal of this test is to evaluate the results from basin_query and basin_query_mpi to demonstrate the produce the same results. *Test case that queries basin_query and basin_query_mpi showing that they return the same depth values.

Test Case for Basin Query depth Algorithm

Goal of this test is to document the algorithms available in ucvmc, and show example return values for each. *Test that confirms basin_query and basin_query_mpi return the same value for the same point. Document which of the basin_query values is returned by basin_query_mpi *Test that shows what basin_query and basin_query_mpi return for points outside the defined volume of the model *Test that shows how basin_query and basin_query_mpi support model tiling.

Test Case for Blue Waters and Titan

*Install UCVMC 17.1 on Blue Water and Titans. *Regenerate ucvm2mesh_mpi meshes and confirm them match ones from USC

Test Case for Tomography Utility Projection

*Test cases showing that projection issue in CCA06 is fixed. Confirm this is in latest UCVMC

Test Case for Basin Region Specs

  • The goal of this test is to reproduce the z1.0 and z2.5 basin models for three California velocity models. These binary files will be given to OpenSHA for use in GMPE calculations. Results we return will describe the algorithm they use to determined the returned depth value. *CCA: [minLat = 33.35, minLon = -123.0, nx = 1551, ny = 1201, gridSpacing = 0.005 degrees] *CVM-S4.26 and CVM-S4.26-M01: [minLat = 31.0, minLon = -121.0, nx = 1701, ny = 1101, gridSpacing = 0.005 degrees] *Output format for the basin data sets is a binary regular mesh format with separate files for Z1.0 and Z2.5 in meters *Output binary files are checked by plotting and comparing with previous versions *The binary files are 4 byte float, little endian, fast XY, no rotation. *The first data point is bottom left (at minX, minY). *The formulas for lat/lon at a given x/y index:
lon = xIndex * gridSpacing + minLon
lat = yIndex * gridSpacing + minLat

*The formula for calculating the file position for a given xIndex/yIndex:

filePos = 4 * (nx * yIndex + xIndex)
⚠️ **GitHub.com Fallback** ⚠️