From f52b7f8414205d5cab4790331f419476802a6b7f Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Tue, 26 Jul 2022 11:01:21 -0700 Subject: [PATCH 01/10] leak --- src/interface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/interface.cpp b/src/interface.cpp index 6efd646..1e922e8 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -8,6 +8,8 @@ Rcpp::NumericVector cum_median_interface (Rcpp::NumericVector data_vec, Rcpp::NumericVector weight_vec){ int n_data = data_vec.size(); + double *unused_ptr = new double[5]; + unused_ptr[0] = data_vec[0]; if(weight_vec.size() != n_data){ Rcpp::stop("weight_vec must be same size as data_vec"); } From c0aacd76b6a50e22a3081be6177c172ee721d6d6 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Tue, 26 Jul 2022 11:01:43 -0700 Subject: [PATCH 02/10] fail_ci_if_error:true --- .github/workflows/RcppDeepState.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml index 55aad0a..4585b57 100644 --- a/.github/workflows/RcppDeepState.yaml +++ b/.github/workflows/RcppDeepState.yaml @@ -20,4 +20,6 @@ jobs: - uses: FabrizioSandri/RcppDeepState-action@main with: - comment: 'true' \ No newline at end of file + comment: 'true' + fail_ci_if_error: 'true' + \ No newline at end of file From 8b37de6697c5a01519f40be5fc7d39b70cf0133d Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Tue, 26 Jul 2022 11:03:33 -0700 Subject: [PATCH 03/10] only pr not push --- .github/workflows/RcppDeepState.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml index 4585b57..c9283d7 100644 --- a/.github/workflows/RcppDeepState.yaml +++ b/.github/workflows/RcppDeepState.yaml @@ -1,8 +1,5 @@ # Workflow derived from https://github.com/FabrizioSandri/RcppDeepState-action/blob/main/.github/workflows/action-test.yaml on: - push: - branches: - - '*' pull_request: branches: - '*' From e9277ec32d165f300e8db275f18f5c77e3e851ec Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Thu, 4 Aug 2022 14:07:23 -0700 Subject: [PATCH 04/10] custom test harness --- ...binseg_interface_DeepState_TestHarness.cpp | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp diff --git a/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp b/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp new file mode 100644 index 0000000..b6b4de5 --- /dev/null +++ b/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include +#include + +RInside Rinstance; + +/** FUNCTION SIGNATURE */ +Rcpp::List binseg_interface(const Rcpp::NumericVector data_vec, const Rcpp::NumericVector weight_vec, +const int max_segments, const int min_segment_length, const std::string distribution_str, +const std::string container_str, const Rcpp::LogicalVector is_validation_vec, const Rcpp::NumericVector position_vec); + +Rcpp::LogicalVector RcppDeepState_LogicalVector(int rand_size){ + Rcpp::LogicalVector rand_vec(rand_size); + for(int i = 0 ; i < rand_size;i++){ + rand_vec[i] = DeepState_IntInRange(0,1); + } + + return rand_vec; +} + +#define INPUTS \ + int n_data = DeepState_IntInRange(1,1000); \ + Rcpp::NumericVector data_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \ + Rcpp::NumericVector weight_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \ + int max_segments = RcppDeepState_int(1, n_data); \ + int min_segment_length = RcppDeepState_int(1, 10); \ + std::string distribution_str = "test"; \ + std::string container_str = "test"; \ + Rcpp::LogicalVector is_validation_vec = RcppDeepState_LogicalVector(n_data); \ + Rcpp::NumericVector position_vec = RcppDeepState_NumericVector(n_data, 0, 1000); + +TEST(binsegRcpp, generator){ + INPUTS +} + +TEST(binsegRcpp, runner){ + INPUTS + + /** INPUTS DUMP + Skipped: the final analysis table will contain an empty inputs column + */ + + try{ + binseg_interface(data_vec, weight_vec, max_segments,min_segment_length, + distribution_str, container_str, is_validation_vec, position_vec); + + }catch(Rcpp::exception& e){ + std::cout<<"Exception Handled"< Date: Tue, 16 Aug 2022 10:21:02 -0700 Subject: [PATCH 05/10] 10 inputs --- .github/workflows/RcppDeepState.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml index c9283d7..9851410 100644 --- a/.github/workflows/RcppDeepState.yaml +++ b/.github/workflows/RcppDeepState.yaml @@ -18,5 +18,6 @@ jobs: - uses: FabrizioSandri/RcppDeepState-action@main with: comment: 'true' + max_inputs: 10 fail_ci_if_error: 'true' \ No newline at end of file From 5c0626a7039ae9a0bdcef7755c22857caab4dc5c Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Tue, 16 Aug 2022 10:29:01 -0700 Subject: [PATCH 06/10] fixed seed --- .github/workflows/RcppDeepState.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml index 9851410..f850f4b 100644 --- a/.github/workflows/RcppDeepState.yaml +++ b/.github/workflows/RcppDeepState.yaml @@ -19,5 +19,6 @@ jobs: with: comment: 'true' max_inputs: 10 + seed: 5 fail_ci_if_error: 'true' \ No newline at end of file From 16d3fe6317a0da8f9ecfd1f91c6c371032976939 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Tue, 16 Aug 2022 10:29:19 -0700 Subject: [PATCH 07/10] only leak for positive data --- src/interface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interface.cpp b/src/interface.cpp index 1e922e8..e6987a4 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -8,8 +8,10 @@ Rcpp::NumericVector cum_median_interface (Rcpp::NumericVector data_vec, Rcpp::NumericVector weight_vec){ int n_data = data_vec.size(); - double *unused_ptr = new double[5]; - unused_ptr[0] = data_vec[0]; + if(data_vec[0] > 0){ + double *unused_ptr = new double[5]; + unused_ptr[0] = data_vec[0]; + } if(weight_vec.size() != n_data){ Rcpp::stop("weight_vec must be same size as data_vec"); } From 32d09699bc55c32c09a70b8580b21c335791fb81 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Wed, 17 Aug 2022 08:51:25 -0700 Subject: [PATCH 08/10] tab ->space --- .github/workflows/RcppDeepState.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml index f850f4b..3a0c98a 100644 --- a/.github/workflows/RcppDeepState.yaml +++ b/.github/workflows/RcppDeepState.yaml @@ -19,6 +19,6 @@ jobs: with: comment: 'true' max_inputs: 10 - seed: 5 + seed: 5 fail_ci_if_error: 'true' - \ No newline at end of file + From 4a570566b72426c93158faa4eb6db74390aef462 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Wed, 24 Aug 2022 10:18:10 -0700 Subject: [PATCH 09/10] rm rcppdeepstate yaml action --- .github/workflows/RcppDeepState.yaml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .github/workflows/RcppDeepState.yaml diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml deleted file mode 100644 index 3a0c98a..0000000 --- a/.github/workflows/RcppDeepState.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Workflow derived from https://github.com/FabrizioSandri/RcppDeepState-action/blob/main/.github/workflows/action-test.yaml -on: - pull_request: - branches: - - '*' - -name: "RcppDeepState + valgrind" - -jobs: - RcppDeepState: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v2 - - - uses: FabrizioSandri/RcppDeepState-action@main - with: - comment: 'true' - max_inputs: 10 - seed: 5 - fail_ci_if_error: 'true' - From 631d0d3cab9543edc1bca14a3151c888e2e414ab Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Wed, 24 Aug 2022 10:35:52 -0700 Subject: [PATCH 10/10] new yaml --- .github/workflows/RcppDeepState.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/RcppDeepState.yaml diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml new file mode 100644 index 0000000..525a324 --- /dev/null +++ b/.github/workflows/RcppDeepState.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + branches: + - '*' + +name: 'RcppDeepState analysis' +jobs: + RcppDeepState: + runs-on: ubuntu-latest + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: FabrizioSandri/RcppDeepState-action@main + with: + fail_ci_if_error: true + seed: 5 + time_limit_seconds: 60 + max_inputs: 100 + comment: true + verbose: true