Skip to content

Commit 09d1765

Browse files
authored
Merge pull request #1790 from olivier-roussel/fix_interactive_tests
Disable interactivity when running TU through ctest
2 parents b509759 + bf5ecd8 commit 09d1765

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

example/particle-filter/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ foreach(cpp ${example_cpp})
5151
endif()
5252
endforeach()
5353

54-
visp_add_test(pf-nonlinear-example-monothread pf-nonlinear-example ${SHORT_OPTION_TO_DISABLE_DISPLAY} --dt 3 --stdev-range 5 --stdev-elev-angle 0.5 --stdev-aircraft-vel 0.2> --gt-X0 -500 --gt-Y0 1000 --gt-vX0 10 --gt-vY0 5 --max-distance-likelihood 50 -N 500 --seed 4224 --nb-threads 1 --ampli-max-X 20 --ampli-max-Y 200 --ampli-max-vX 1 --ampli-max-vY 0.5)
55-
visp_add_test(pf-nonlinear-example-multithread pf-nonlinear-example ${SHORT_OPTION_TO_DISABLE_DISPLAY} --dt 3 --stdev-range 5 --stdev-elev-angle 0.5 --stdev-aircraft-vel 0.2> --gt-X0 -500 --gt-Y0 1000 --gt-vX0 10 --gt-vY0 5 --max-distance-likelihood 50 -N 500 --seed 4224 --nb-threads -1 --ampli-max-X 20 --ampli-max-Y 200 --ampli-max-vX 1 --ampli-max-vY 0.5)
56-
visp_add_test(pf-nonlinear-complex-example-monothread pf-nonlinear-complex-example ${SHORT_OPTION_TO_DISABLE_DISPLAY} --max-distance-likelihood 0.5 --ampli-max-X 0.25 --ampli-max-Y 0.25 --ampli-max-theta 0.1 -N 500 --nb-threads 1)
57-
visp_add_test(pf-nonlinear-complex-example-multithread pf-nonlinear-complex-example ${SHORT_OPTION_TO_DISABLE_DISPLAY} --max-distance-likelihood 0.5 --ampli-max-X 0.25 --ampli-max-Y 0.25 --ampli-max-theta 0.1 -N 500 --nb-threads -1)
54+
visp_add_test(pf-nonlinear-example-monothread pf-nonlinear-example -c ${SHORT_OPTION_TO_DISABLE_DISPLAY} --dt 3 --stdev-range 5 --stdev-elev-angle 0.5 --stdev-aircraft-vel 0.2> --gt-X0 -500 --gt-Y0 1000 --gt-vX0 10 --gt-vY0 5 --max-distance-likelihood 50 -N 500 --seed 4224 --nb-threads 1 --ampli-max-X 20 --ampli-max-Y 200 --ampli-max-vX 1 --ampli-max-vY 0.5)
55+
visp_add_test(pf-nonlinear-example-multithread pf-nonlinear-example -c ${SHORT_OPTION_TO_DISABLE_DISPLAY} --dt 3 --stdev-range 5 --stdev-elev-angle 0.5 --stdev-aircraft-vel 0.2> --gt-X0 -500 --gt-Y0 1000 --gt-vX0 10 --gt-vY0 5 --max-distance-likelihood 50 -N 500 --seed 4224 --nb-threads -1 --ampli-max-X 20 --ampli-max-Y 200 --ampli-max-vX 1 --ampli-max-vY 0.5)
56+
visp_add_test(pf-nonlinear-complex-example-monothread pf-nonlinear-complex-example -c ${SHORT_OPTION_TO_DISABLE_DISPLAY} --max-distance-likelihood 0.5 --ampli-max-X 0.25 --ampli-max-Y 0.25 --ampli-max-theta 0.1 -N 500 --nb-threads 1)
57+
visp_add_test(pf-nonlinear-complex-example-multithread pf-nonlinear-complex-example -c ${SHORT_OPTION_TO_DISABLE_DISPLAY} --max-distance-likelihood 0.5 --ampli-max-X 0.25 --ampli-max-Y 0.25 --ampli-max-theta 0.1 -N 500 --nb-threads -1)

example/particle-filter/pf-nonlinear-complex-example.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ struct SoftwareArguments
594594
// --- Main loop parameters---
595595
static const int SOFTWARE_CONTINUE = 42;
596596
bool m_useDisplay; //!< If true, activate the plot and the renderer if VISP_HAVE_DISPLAY is defined.
597+
bool m_useUserInteraction; //!< If true, program will require some user inputs.
597598
unsigned int m_nbStepsWarmUp; //!< Number of steps for the warmup phase.
598599
// --- PF parameters---
599600
unsigned int m_N; //!< The number of particles.
@@ -606,6 +607,7 @@ struct SoftwareArguments
606607

607608
SoftwareArguments()
608609
: m_useDisplay(true)
610+
, m_useUserInteraction(true)
609611
, m_nbStepsWarmUp(200)
610612
, m_N(500)
611613
, m_maxDistanceForLikelihood(0.5)
@@ -656,6 +658,9 @@ struct SoftwareArguments
656658
else if (arg == "-d") {
657659
m_useDisplay = false;
658660
}
661+
else if (arg == "-c" ) {
662+
m_useUserInteraction = false;
663+
}
659664
else if ((arg == "-h") || (arg == "--help")) {
660665
printUsage(std::string(argv[0]));
661666
SoftwareArguments defaultArgs;
@@ -697,6 +702,7 @@ struct SoftwareArguments
697702
std::cout << " [--max-distance-likelihood <double>] [-N, --nb-particles <uint>] [--seed <int>] [--nb-threads <int>]" << std::endl;
698703
std::cout << " [--ampli-max-X <double>] [--ampli-max-Y <double>] [--ampli-max-theta <double>]" << std::endl;
699704
std::cout << " [-d, --no-display] [-h]" << std::endl;
705+
std::cout << " [-c] [-h]" << std::endl;
700706
}
701707

702708
void printDetails()
@@ -746,6 +752,10 @@ struct SoftwareArguments
746752
#else
747753
std::cout << "OFF" << std::endl;
748754
#endif
755+
std::cout << std::endl;
756+
std::cout << " -c" << std::endl;
757+
std::cout << " Deactivate user interaction." << std::endl;
758+
std::cout << " Default: user interaction enabled: " << m_useUserInteraction << std::endl;
749759
std::cout << std::endl;
750760
std::cout << " -h, --help" << std::endl;
751761
std::cout << " Display this help." << std::endl;
@@ -902,7 +912,7 @@ int main(const int argc, const char *argv[])
902912
std::cout << "Mean error noise = " << meanErrorNoise << std::endl;
903913
std::cout << "Mean filtering time = " << averageFilteringTime << "us" << std::endl;
904914

905-
if (args.m_useDisplay) {
915+
if (args.m_useUserInteraction) {
906916
std::cout << "Press Enter to quit..." << std::endl;
907917
std::cin.get();
908918
}

example/particle-filter/pf-nonlinear-example.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ struct SoftwareArguments
327327
// --- Main loop parameters---
328328
static const int SOFTWARE_CONTINUE = 42;
329329
bool m_useDisplay; //!< If true, activate the plot and the renderer if VISP_HAVE_DISPLAY is defined.
330+
bool m_useUserInteraction; //!< If true, program will require some user inputs.
330331
unsigned int m_nbStepsWarmUp; //!< Number of steps for the warmup phase.
331332
unsigned int m_nbSteps; //!< Number of steps for the main loop.
332333
double m_dt; // Period, expressed in seconds
@@ -351,6 +352,7 @@ struct SoftwareArguments
351352

352353
SoftwareArguments()
353354
: m_useDisplay(true)
355+
, m_useUserInteraction(true)
354356
, m_nbStepsWarmUp(200)
355357
, m_nbSteps(300)
356358
, m_dt(3.)
@@ -461,6 +463,9 @@ struct SoftwareArguments
461463
else if (arg == "-d") {
462464
m_useDisplay = false;
463465
}
466+
else if (arg == "-c" ) {
467+
m_useUserInteraction = false;
468+
}
464469
else if ((arg == "-h") || (arg == "--help")) {
465470
printUsage(std::string(argv[0]));
466471
SoftwareArguments defaultArgs;
@@ -505,6 +510,7 @@ struct SoftwareArguments
505510
std::cout << " [--max-distance-likelihood <double>] [-N, --nb-particles <uint>] [--seed <int>] [--nb-threads <int>]" << std::endl;
506511
std::cout << " [--ampli-max-X <double>] [--ampli-max-Y <double>] [--ampli-max-vX <double>] [--ampli-max-vY <double>]" << std::endl;
507512
std::cout << " [-d, --no-display] [-h]" << std::endl;
513+
std::cout << " [-c] [-h]" << std::endl;
508514
}
509515

510516
void printDetails()
@@ -608,6 +614,10 @@ struct SoftwareArguments
608614
#else
609615
std::cout << "OFF" << std::endl;
610616
#endif
617+
std::cout << std::endl;
618+
std::cout << " -c" << std::endl;
619+
std::cout << " Deactivate user interaction." << std::endl;
620+
std::cout << " Default: user interaction enabled: " << m_useUserInteraction << std::endl;
611621
std::cout << std::endl;
612622
std::cout << " -h, --help" << std::endl;
613623
std::cout << " Display this help." << std::endl;
@@ -791,7 +801,7 @@ int main(const int argc, const char *argv[])
791801
std::cout << "Mean error noise = " << meanErrorNoise << "m" << std::endl;
792802
std::cout << "Mean filtering time = " << averageFilteringTime << "us" << std::endl;
793803

794-
if (args.m_useDisplay) {
804+
if (args.m_useUserInteraction) {
795805
std::cout << "Press Enter to quit..." << std::endl;
796806
std::cin.get();
797807
}

0 commit comments

Comments
 (0)