Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/fix_code_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

#
# Need to install the prettier package first
#
#npm install --save-dev prettier

npx prettier --write ../src/test
npx prettier --write ../src/performance
40 changes: 40 additions & 0 deletions scripts/get_perf_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -euo pipefail

FILE="${1:-}"
if [[ -z "$FILE" || ! -f "$FILE" ]]; then
echo "Usage: $0 <logfile>"
exit 2
fi

get_time_by_key() {
local key="$1"
local ms
ms="$(grep -F -- "$key" "$FILE" | head -n 1 | sed -E 's/.*-> ([0-9]+) ms/\1/')"
printf '%s %s ms\n' "$key" "$ms"
}

get_time_by_key "PERF_ANIMATOR_CONTOUR_CASA.test.ts"
get_time_by_key "PERF_ANIMATOR_CONTOUR_HDF5.test.ts"
get_time_by_key "PERF_ANIMATOR_CONTOUR_FITS.test.ts"
get_time_by_key "PERF_MOMENTS_CASA.test.ts"
get_time_by_key "PERF_MOMENTS_FITS.test.ts"
get_time_by_key "PERF_MOMENTS_HDF5.test.ts"
get_time_by_key "PERF_PV_CASA.test.ts"
get_time_by_key "PERF_PV_HDF5.test.ts"
get_time_by_key "PERF_PV_FITS.test.ts"
get_time_by_key "PERF_REGION_SPECTRAL_PROFILE_CASA.test.ts"
get_time_by_key "PERF_REGION_SPECTRAL_PROFILE_HDF5.test.ts"
get_time_by_key "PERF_REGION_SPECTRAL_PROFILE_FITS.test.ts"
get_time_by_key "PERF_CONTOUR_DATA_Mode2.test.ts"
get_time_by_key "PERF_CONTOUR_DATA_Mode0.test.ts"
get_time_by_key "PERF_CONTOUR_DATA_Mode1.test.ts"
get_time_by_key "PERF_CUBE_HISTOGRAM_CASA.test.ts"
get_time_by_key "PERF_CUBE_HISTOGRAM_FITS.test.ts"
get_time_by_key "PERF_CUBE_HISTOGRAM_HDF5.test.ts"
get_time_by_key "PERF_RASTER_TILE_DATA_CASA.test.ts"
get_time_by_key "PERF_RASTER_TILE_DATA_FITS.test.ts"
get_time_by_key "PERF_RASTER_TILE_DATA_HDF5.test.ts"
get_time_by_key "PERF_LOAD_IMAGE_CASA.test.ts"
get_time_by_key "PERF_LOAD_IMAGE_HDF5.test.ts"
get_time_by_key "PERF_LOAD_IMAGE_FITS.test.ts"
56 changes: 56 additions & 0 deletions scripts/parse_perf_log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -euo pipefail

FILE="${1:-}"

if [[ -z "$FILE" || ! -f "$FILE" ]]; then
echo "Usage: $0 <logfile>"
exit 1
fi

awk '
BEGIN {
# ------------------------------------------
# Define target texts (edit freely)
# ------------------------------------------
targets[1] = "(Play forward) Image should return one after one and the last channel is correct"
targets[2] = "(Play backward) Image should return one after one and the last channel is correct"
targets[3] = "Receive a series of moment progress within"
targets[4] = "PV Response should arrived within"
targets[5] = "SPECTRAL_PROFILE_DATA stream should arrive within"
targets[6] = "ContourImageData responses should arrive within"
targets[7] = "REGION_HISTOGRAM_DATA should arrive completely within"
targets[8] = "RasterTileData responses should arrive within"
targets[9] = "(PERF_LOAD_IMAGE) OPEN_FILE_ACK and REGION_HISTOGRAM_DATA should arrive within"

# ------------------------------------------
# Automatically count targets
# ------------------------------------------
ntargets = 0
for (i in targets) {
ntargets++
}
}

/^PASS / {
pass_line = $0
next
}

{
for (i = 1; i <= ntargets; i++) {
t = targets[i]
if (index($0, t)) {

if (match($0, /\([0-9]+ ms\)/)) {
s = substr($0, RSTART, RLENGTH)
gsub(/[()]/, "", s)
gsub(/ ms/, "", s)
print pass_line " -> " t " -> " s " ms"
} else {
print pass_line " -> " t " -> (no time found)"
}
}
}
}
' "$FILE"
8 changes: 8 additions & 0 deletions scripts/recompile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd ..
npm install

cd protobuf
./build_proto.sh

25 changes: 25 additions & 0 deletions scripts/run_icd_tests_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# --------------------------------------------------------------------------------------------------
# ls ../ICD_test_stages
#
# animator.tests file_browser.tests pv_generator.tests resume.tests
# catalog.tests image_fitting.tests raster_tiles.tests vector_overlay.tests
# close_file.tests match.tests region_manipulation.tests
# cube_histogram.tests moment.tests region_statistics.tests
# --------------------------------------------------------------------------------------------------

./run_icd_tests_stage.sh animator
./run_icd_tests_stage.sh catalog
./run_icd_tests_stage.sh close_file
./run_icd_tests_stage.sh cube_histogram
./run_icd_tests_stage.sh file_browser
./run_icd_tests_stage.sh image_fitting
./run_icd_tests_stage.sh match
./run_icd_tests_stage.sh moment
./run_icd_tests_stage.sh pv_generator
./run_icd_tests_stage.sh raster_tiles
./run_icd_tests_stage.sh region_manipulation
./run_icd_tests_stage.sh region_statistics
./run_icd_tests_stage.sh resume
./run_icd_tests_stage.sh vector_overlay
13 changes: 13 additions & 0 deletions scripts/run_icd_tests_specific.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e # stop on first failure

BASE="src/test"

TESTS=(
CHANNEL_MAP.test.ts
)

for test in "${TESTS[@]}"; do
npm test "$BASE/$test"
done

23 changes: 23 additions & 0 deletions scripts/run_icd_tests_stage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# --------------------------------------------------------------------------------------------------
# ls ../ICD_test_stages
#
# animator.tests file_browser.tests pv_generator.tests resume.tests
# catalog.tests image_fitting.tests raster_tiles.tests vector_overlay.tests
# close_file.tests match.tests region_manipulation.tests
# cube_histogram.tests moment.tests region_statistics.tests
# --------------------------------------------------------------------------------------------------

# --------------------------------------------------------------------------------------------------
# Example:
# ./run_icd_tests_stage.sh animator
# --------------------------------------------------------------------------------------------------

TEST_CLASS=$1

for test_file in $(cat ../ICD_test_stages/$TEST_CLASS.tests); do
# echo $test_file
npm test $test_file
# sleep 3 && pgrep carta_backend
done
4 changes: 4 additions & 0 deletions scripts/run_perf_tests_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e # stop on first failure

CI=true npm test -- src/performance > perf-test.log 2>&1
36 changes: 36 additions & 0 deletions scripts/run_perf_tests_specific.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
set -e # stop on first failure

BASE="src/performance"

TESTS=(
PERF_ANIMATOR_CONTOUR_CASA.test.ts
PERF_ANIMATOR_CONTOUR_FITS.test.ts
PERF_ANIMATOR_CONTOUR_HDF5.test.ts
PERF_CONTOUR_DATA_Mode0.test.ts
PERF_CONTOUR_DATA_Mode1.test.ts
PERF_CONTOUR_DATA_Mode2.test.ts
PERF_CUBE_HISTOGRAM_CASA.test.ts
PERF_CUBE_HISTOGRAM_FITS.test.ts
PERF_CUBE_HISTOGRAM_HDF5.test.ts
PERF_LOAD_IMAGE_CASA.test.ts
PERF_LOAD_IMAGE_FITS.test.ts
PERF_LOAD_IMAGE_HDF5.test.ts
PERF_MOMENTS_CASA.test.ts
PERF_MOMENTS_FITS.test.ts
PERF_MOMENTS_HDF5.test.ts
PERF_PV_CASA.test.ts
PERF_PV_FITS.test.ts
PERF_PV_HDF5.test.ts
PERF_RASTER_TILE_DATA_CASA.test.ts
PERF_RASTER_TILE_DATA_FITS.test.ts
PERF_RASTER_TILE_DATA_HDF5.test.ts
PERF_REGION_SPECTRAL_PROFILE_CASA.test.ts
PERF_REGION_SPECTRAL_PROFILE_FITS.test.ts
PERF_REGION_SPECTRAL_PROFILE_HDF5.test.ts
)

for test in "${TESTS[@]}"; do
npm test "$BASE/$test"
done

8 changes: 4 additions & 4 deletions src/performance/PERF_ANIMATOR_CONTOUR_CASA.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { take } from 'rxjs/operators';
let connectTimeout = config.timeout.connection;
let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let openFileTimeout: number = config.timeout.openFile;
let readFileTimeout: number = config.timeout.readFile;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.performance.readFile;
let playAnimatorTimeout = config.performance.playAnimator;

interface AssertItem {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play forward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[0]);
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play backward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[1]);
Expand Down
8 changes: 4 additions & 4 deletions src/performance/PERF_ANIMATOR_CONTOUR_FITS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { take } from 'rxjs/operators';
let connectTimeout = config.timeout.connection;
let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let openFileTimeout: number = config.timeout.openFile;
let readFileTimeout: number = config.timeout.readFile;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.performance.readFile;
let playAnimatorTimeout = config.performance.playAnimator;

interface AssertItem {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play forward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[0]);
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play backward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[1]);
Expand Down
8 changes: 4 additions & 4 deletions src/performance/PERF_ANIMATOR_CONTOUR_HDF5.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { take } from 'rxjs/operators';
let connectTimeout = config.timeout.connection;
let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let openFileTimeout: number = config.timeout.openFile;
let readFileTimeout: number = config.timeout.readFile;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.performance.readFile;
let playAnimatorTimeout = config.performance.playAnimator;

interface AssertItem {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play forward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[0]);
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('ANIMATOR_CONTOUR: Testing animation playback with contour lines', () =
let HistogramSequence: number[] = [];
let ContourSequence: number[] = [];
test(
`Image should return one after one and the last channel is correct:`,
`(Play backward) Image should return one after one and the last channel is correct`,
async () => {
let StartAnimationResponse: CARTA.IStartAnimationAck;
StartAnimationResponse = await msgController.startAnimation(assertItem.startAnimation[1]);
Expand Down
2 changes: 1 addition & 1 deletion src/performance/PERF_CONTOUR_DATA_Mode0.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let connectTimeout: number = config.timeout.connection;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.timeout.readFile;
let readFileTimeout: number = config.performance.readFile;
let playContourTimeout: number = config.performance.playContour;

interface AssertItem {
Expand Down
2 changes: 1 addition & 1 deletion src/performance/PERF_CONTOUR_DATA_Mode1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let connectTimeout: number = config.timeout.connection;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.timeout.readFile;
let readFileTimeout: number = config.performance.readFile;
let playContourTimeout: number = config.performance.playContour;

interface AssertItem {
Expand Down
2 changes: 1 addition & 1 deletion src/performance/PERF_CONTOUR_DATA_Mode2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let connectTimeout: number = config.timeout.connection;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.timeout.readFile;
let readFileTimeout: number = config.performance.readFile;
let playContourTimeout: number = config.performance.playContour;

interface AssertItem {
Expand Down
6 changes: 3 additions & 3 deletions src/performance/PERF_LOAD_IMAGE_CASA.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let connectTimeout: number = config.timeout.connection;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.timeout.readFile;
let readFileTimeout: number = config.performance.readFile;

interface AssertItem {
fileOpen: CARTA.IOpenFile[];
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('PERF_LOAD_IMAGE', () => {

describe(`Initialization: open the image`, () => {
test(
`(Step 1)"${assertItem.fileOpen[0].file}" OPEN_FILE_ACK and REGION_HISTOGRAM_DATA should arrive within ${openFileTimeout} ms`,
`"${assertItem.fileOpen[0].file}" (PERF_LOAD_IMAGE) OPEN_FILE_ACK and REGION_HISTOGRAM_DATA should arrive within ${openFileTimeout} ms`,
async () => {
msgController.closeFile(-1);
msgController.closeFile(0);
Expand All @@ -75,7 +75,7 @@ describe('PERF_LOAD_IMAGE', () => {
);

test(
`(Step 1)"${assertItem.fileOpen[0].file}" SetImageChannels & SetCursor responses should arrive within ${readFileTimeout} ms`,
`"${assertItem.fileOpen[0].file}" (PERF_LOAD_IMAGE) SetImageChannels & SetCursor responses should arrive within ${readFileTimeout} ms`,
async () => {
msgController.addRequiredTiles(assertItem.initTilesReq);
let RasterTileDataResponse = await Stream(
Expand Down
6 changes: 3 additions & 3 deletions src/performance/PERF_LOAD_IMAGE_FITS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let testServerUrl: string = config.serverURL0;
let testSubdirectory: string = config.path.performance;
let connectTimeout: number = config.timeout.connection;
let openFileTimeout: number = config.performance.openFile;
let readFileTimeout: number = config.timeout.readFile;
let readFileTimeout: number = config.performance.readFile;

interface AssertItem {
fileOpen: CARTA.IOpenFile[];
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('PERF_LOAD_IMAGE', () => {

describe(`Initialization: open the image`, () => {
test(
`(Step 1)"${assertItem.fileOpen[0].file}" OPEN_FILE_ACK and REGION_HISTOGRAM_DATA should arrive within ${openFileTimeout} ms`,
`"${assertItem.fileOpen[0].file}" (PERF_LOAD_IMAGE) OPEN_FILE_ACK and REGION_HISTOGRAM_DATA should arrive within ${openFileTimeout} ms`,
async () => {
msgController.closeFile(-1);
msgController.closeFile(0);
Expand All @@ -75,7 +75,7 @@ describe('PERF_LOAD_IMAGE', () => {
);

test(
`(Step 1)"${assertItem.fileOpen[0].file}" SetImageChannels & SetCursor responses should arrive within ${readFileTimeout} ms`,
`"${assertItem.fileOpen[0].file}" (PERF_LOAD_IMAGE) SetImageChannels & SetCursor responses should arrive within ${readFileTimeout} ms`,
async () => {
msgController.addRequiredTiles(assertItem.initTilesReq);
let RasterTileDataResponse = await Stream(
Expand Down
Loading