arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
63 "Wrapper for upstream FreeTDS tests");
65arg_desc->AddDefaultKey
66(
"-ms-ver",
"TDSVersion",
67 "TDS protocol version to use for MS SQL servers",
69arg_desc->AddOptionalKey
70(
"-syb-ver",
"TDSVersion",
71 "TDS protocol version to use for Sybase servers",
73arg_desc->AddOptionalKey
74(
"-set-env",
"Setting",
75 "Set a custom environment variable; format: NAME=value; " 80 "Skip in automated runs due to use of non-temporary objects.");
82arg_desc->AddPositional
95 if(args[
"-no-auto"]) {
97 env.Get(
"NCBI_AUTOMATED_BUILD", &is_automated);
99 NcbiCout<<
"NCBI_UNITTEST_SKIPPED\n";
105 if(sybase_dir.
Exists() ||
env.Get(
"SYBASE").empty()) {
108 if(args[
"-set-env"]) {
117 string cmd= args[
"test-command"].AsString(),
118cmdline =
env.Get(
"CHECK_EXEC");
119 if( !cmdline.empty() ) {
122cmdline =
"sh "+ cmdline;
131 _TRACE(
"PATH: "<<
env.Get(
"PATH"));
132 _TRACE(
"Command: "<< cmdline);
136 stringprefix =
cmd.substr(0,
cmd.find(
'_') + 1),
137base =
cmd.substr(prefix.size());
138 if(
CFile(base +
".sql").Exists() ||
CFile(base +
".in").Exists()) {
139vector<string> dirs(1,
"."), masks, found;
140masks.push_back(base +
".??*");
141masks.push_back(base +
"_*.??*");
143 ITERATE(vector<string>, it, found) {
145 f.Copy(prefix +
f.GetName(),
151 if(
CFile(
"odbc.ini").Exists()) {
152 env.Set(
"ODBCINI",
"odbc.ini");
153 env.Set(
"SYSODBCINI",
"odbc.ini");
157 boolsucceeded_anywhere =
false;
160 for(
const char*
const* s =
kServers; *s !=
NULL; ++s) {
161 if(strstr(*s,
"MS") !=
NULL) {
162 env.Set(
"TDSVER", args[
"-ms-ver"].AsString());
163}
else if(args[
"-syb-ver"]) {
164 env.Set(
"TDSVER", args[
"-syb-ver"].AsString());
166 env.Unset(
"TDSVER");
169 stringtdspwdfile =
string(
"login-info-") + *s +
".txt";
172<<
"\nUID=DBAPI_test\nPWD=allowed\nDB=DBAPI_Sample\n";
173 env.Set(
"TDSPWDFILE", tdspwdfile);
175 NcbiCout<< *s <<
"\n--------------------"<< endl;
177 if(this_status == 0) {
178 NcbiCout<<
"... SUCCEEDED on "<< *s <<
'\n';
179succeeded_anywhere =
true;
180}
else if(this_status == 77) {
181 NcbiCout<<
"... SKIPPED on "<< *s <<
'\n';
183status = this_status;
184 NcbiCout<<
"... FAILED on "<< *s <<
", with status "<< status
186failures <<
' '<< *s <<
" ("<< status <<
')';
194}
else if( !succeeded_anywhere ) {
195 NcbiCout<<
"NCBI_UNITTEST_SKIPPED\n";
204 int main(
intargc,
char** argv)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
void Init(void)
Initialize the application.
int Run(void)
Run the application.
Include a standard set of the NCBI C++ Toolkit most basic headers.
CNcbiEnvironment & SetEnvironment(void)
Get a non-const copy of the application's cached environment.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
vector< string > TStringArray
Some values types can contain several value lists.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ eString
An arbitrary string.
static TExitCode System(const char *cmdline)
Execute the specified command.
static string QuoteArg(const string &arg)
Quote argument.
void FindFiles(TPathIterator path_begin, TPathIterator path_end, const vector< string > &masks, TFindFunc &find_func, TFindFiles flags=fFF_Default)
Generic algorithm for file search.
virtual bool Exists(void) const
Check if directory "dirname" exists.
const string & GetPath(void) const
Get entry path.
@ fCF_Overwrite
The following flags define what to do when the destination entry already exists:
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines access to miscellaneous global configuration settings.
const char * NCBI_GetDefaultSybasePath(void)
Get default Sybase client installation path.
Defines unified interface to application:
Defines a portable execute class.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
int main(int argc, char **argv)
static const char * kServers[]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4