1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 | // *****************************************************************************
/*!
\file src/Control/UnitTestConfig.hpp
\copyright 2012-2015 J. Bakosi,
2016-2018 Los Alamos National Security, LLC.,
2019-2021 Triad National Security, LLC.,
2022-2025 J. Bakosi
All rights reserved. See the LICENSE file for details.
\brief UnitTest's command line
*/
// *****************************************************************************
#pragma once
#include <getopt.h><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include "NoWarning/charm++.hpp"<--- Include file: "NoWarning/charm++.hpp" not found.
#include "XystConfig.hpp"
#include "Exception.hpp"
#include "Print.hpp"
#include "TaggedTuple.hpp"
#include "PrintTaggedTupleDeep.hpp"
#include "Writer.hpp"
namespace tag {
DEFTAG( group );
DEFTAG( quiescence );
} // tag::
namespace unittest {
//! UnitTest control facilitating user input to internal data transfer
namespace ctr {
//! Member data for tagged tuple
using ConfigMembers = brigand::list<
tag::group, std::string // groups to test
, tag::quiescence, bool // enable quiescence detection
>;
//! Config is a TaggedTuple specialized to MeshConv
class Config : public tk::TaggedTuple< ConfigMembers > {
public:
//! Parse unittest command line
void cmdline( int argc, char** argv ) {
tk::Print print;
// Process command line arguments
int c;
while ((c = getopt( argc, argv, "h?g:qv" )) != -1) {
switch (c) {
case '?':
case 'h':
default:
help( argv );
CkExit();
break;
case 'g':
get< tag::group >() = optarg;
break;
case 'q':
get< tag::quiescence >() = true;
break;
case 'v':
print << '\n';
print.version( tk::unittest_executable(), tk::git_commit() );
CkExit();
break;
}
}
if (optind != argc) {
print << "\nA non-option was supplied";
help( argv );
CkExit( EXIT_FAILURE );
}
// Output state to file
auto logfilename = tk::unittest_executable() + "_cmdline.log";
tk::Writer log( logfilename );
tk::print( log.stream(), *this );
}
//! Print help
void help( char** argv ) {
tk::Print() <<
"\nUsage: " << argv[0] << " [OPTION]...\n"
"\n"
" -h, -? Print out this help\n"
" -g <group> Select test-group to run\n"
" -q Enable quiescence detection\n"
" -v Print revision information\n"
"\n";
}
/** @name Pack/Unpack: Serialize Config object for Charm++ */
///@{
//! \brief Pack/Unpack serialize member function
//! \param[in,out] p Charm++'s PUP::er serializer object reference
void pup( PUP::er& p ) { tk::TaggedTuple< ConfigMembers >::pup(p); }<--- Derived function 'Config::pup'
//! \brief Pack/Unpack serialize operator|
//! \param[in,out] p Charm++'s PUP::er serializer object reference
//! \param[in,out] c Config object reference
friend void operator|( PUP::er& p, Config& c ) { c.pup(p); }
//@}
};
} // ctr::
} // unittest::
|