Skip to content

Commit 2cbe807

Browse files
Merge pull request datashield#660 from StuartWheater/v6.3.6-dev_feat-perf-support
Permit perf test duration to be set, seconds, by environment variable…
2 parents 7cddd3a + 5a3bf58 commit 2cbe807

13 files changed

Lines changed: 30 additions & 25 deletions

tests/testthat/perf_tests/perf_rate.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ perf.reference.save <- function(perf.ref.name, rate, tolerance.lower, tolerance.
5757
.perf.reference <<- .perf.reference
5858
}
5959

60+
# Obtain performance test duration from PERF_DURATION_SEC environment variable, otherwise default.duration argument, otherwise "30".
61+
perf.testduration <- function(default.duration = 30) {
62+
base::as.integer(base::Sys.getenv("PERF_DURATION_SEC", unset = base::as.character(default.duration)))
63+
}
64+
6065
perf.reference.rate <- function(perf.ref.name) {
6166
if (is.null(.perf.reference))
6267
.load.pref()

tests/testthat/test-perf-conndisconn.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -22,7 +22,7 @@ disconnect.studies.dataset.cnsim()
2222

2323
# context("conndisconn::perf::simple0")
2424
test_that("simple connect - disconnect performance", {
25-
.durationSec <- 120 # seconds
25+
.durationSec <- perf.testduration(120)
2626
.count <- 0
2727
.start.time <- Sys.time()
2828
.current.time <- .start.time

tests/testthat/test-perf-ds.abs.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.abs::perf:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.asInteger.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("GENDER"))
2121

2222
# context("ds.asInteger::perf:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.asList.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.asList::perf:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.asNumeric.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("GENDER"))
2121

2222
# context("ds.asNumeric::perf:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.assign.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.assign::perf::0")
2323
test_that("performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.class::perf::combine:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.colnames.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.colnames::perf:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

tests/testthat/test-perf-ds.exists.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
2121

2222
# context("ds.exists::perf::combine:0")
2323
test_that("combine - performance", {
24-
.durationSec <- 30 # seconds
24+
.durationSec <- perf.testduration(30)
2525
.count <- 0
2626
.start.time <- Sys.time()
2727
.current.time <- .start.time

0 commit comments

Comments
 (0)