test_run - Launch tests (original) (raw)

Please note that the recommended version of Scilab is 2026.0.1. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Development tools > test_run

Calling Sequence

N = test_run() N = test_run(module[,test_name[,options]])

Arguments

module

A String array. This input argument must be

test_name

A string array

options

A string array

Description

Search for .tst files in the unit test and non-regression test library execute them, and display a report about success of failures. The .tst files are searched in directories SCI+"/modules/*/tests/unit_tests" and SCI+"/modules/*/tests/nonreg_tests". Whenever a test is executed, a .dia file is generated which contains the full list of commands executed along with message which appears in the console. When the script is done, the .dia file is compared with the .dia.ref file which is expected to be in the same directory as the .tst file. If the two file are different, the test fails.

Special tags may be inserted in the .tst file, which help to control the processing of the corresponding test. These tags are expected to be found in Scilab comments.

These are the available tags:

Each test is executed in a separated process, created with the "host" command. That enables the current command to continue, even if the test as created an unstable environment. It also enables the tests to be independent from one another.

Platform-specific tests

It may happen that the output of a test depends on the platform on which it is executed. In this case, the .ref file cannot be correct for all platforms and unit tests may fail for some platform. In this case, we can create a default .ref and create additionnal .ref file for each platform.

The various platform-specific .ref files must have one of the following extensions.

The algorithm is the following. First, the .ref is considered. If this file does not exist, the platform-specific .ref file is examined depending on the current platform.

Examples

test_run(); test_run([]); test_run([],[]);

test_run('time');

test_run(['time','string']);

test_run(['optimization|neldermead']);

test_run(SCI+'/modules/core');

test_run('time','datenum');

test_run('time',['datenum';'calendar']);

test_run('time',['datenum';'calendar'],'skip_tests');

test_run('time','datenum','no_check_ref');

test_run([],[],'create_ref');

test_run([],[],'list');

test_run([],[],'help');

test_run([],[],'nonreg_test');

test_run([],[],'unit_test');

test_run('boolean','bug_2799','no_check_error_output');

test_run([],[],['no_check_ref','mode_nw']);

Internal Design

The tests are performed in the temporary directory, not in the directory which originaly contain the tests files. The .tst file is copied into the temporary directory, the test is performed and the .dia.ref is copied back into the original location.

The .tst script is not run as is. Instead, a header and a footer are inserted at the beginning and at the end of the .tst at the time the script is copied into the temporary directory. The role of this modification is to redirect the output messages into the .dia file, so that the user can have a log file once the test is performed.

Authors