Skip to content
Merged
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
5 changes: 5 additions & 0 deletions tests/testthat/perf_tests/perf_rate.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ perf.reference.save <- function(perf.ref.name, rate, tolerance.lower, tolerance.
.perf.reference <<- .perf.reference
}

# Obtain performance test duration from PERF_DURATION_SEC environment variable, otherwise default.duration argument, otherwise "30".
perf.testduration <- function(default.duration = 30) {
base::as.integer(base::Sys.getenv("PERF_DURATION_SEC", unset = base::as.character(default.duration)))
}

perf.reference.rate <- function(perf.ref.name) {
if (is.null(.perf.reference))
.load.pref()
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-conndisconn.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -22,7 +22,7 @@ disconnect.studies.dataset.cnsim()

# context("conndisconn::perf::simple0")
test_that("simple connect - disconnect performance", {
.durationSec <- 120 # seconds
.durationSec <- perf.testduration(120)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.abs.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.abs::perf:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you have set the default as 30, you could rely on the default, ieperf.testduration(). But maybe you've done it like this to make it explicit. I'll approve the PR, and leave it up to you if you want to change or not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be that a person reviewing the code would have an indication that the duration was alterable.

.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.asInteger.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("GENDER"))

# context("ds.asInteger::perf:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.asList.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.asList::perf:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.asNumeric.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("GENDER"))

# context("ds.asNumeric::perf:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.assign.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.assign::perf::0")
test_that("performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.class.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.class::perf::combine:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.colnames.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.colnames::perf:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.exists.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.exists::perf::combine:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-ds.length.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.length::perf::combine:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-perf-ds.mean.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))

# context("ds.mean::perf::combine:0")
test_that("combine - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down Expand Up @@ -52,7 +52,7 @@ test_that("combine - performance", {

# context("ds.mean::perf::split:0")
test_that("split - performance", {
.durationSec <- 30 # seconds
.durationSec <- perf.testduration(30)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-perf-void.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
Expand All @@ -20,7 +20,7 @@

# context("void::perf::void::0")
test_that("simple void performance", {
.durationSec <- 60 # seconds
.durationSec <- perf.testduration(60)
.count <- 0
.start.time <- Sys.time()
.current.time <- .start.time
Expand Down
Loading