-
Notifications
You must be signed in to change notification settings - Fork 181
Cleanups from NCBI as of May 2024 #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e8f23eb
2ba3969
1835fb3
3c39cee
c996ac7
bbe2948
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #ifndef _tdsguard_afBM6E9n8CuIFSBHNNblq5 | ||
| #define _tdsguard_afBM6E9n8CuIFSBHNNblq5 | ||
|
|
||
| /* | ||
| * Base header for FreeTDS unit tests, even those just covering helpers | ||
| * from the utils and replacements trees. Should be included first | ||
| * (possibly via a common.h) to be certain of preceding <assert.h>. | ||
| */ | ||
|
|
||
| /* Ensure assert is always active. */ | ||
| #undef NDEBUG | ||
| #ifdef assert | ||
| # error "Include test_base.h (or common.h) earlier" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test turns out to be too strong for some tests. The problem is that some tests include, at the beginning, a C file and that's supposed to be the first thing they do (all some linking trick). Would be enough to check that NDEBUG is not defined instead ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I already adjusted these tests to start with appropriate At any rate, if this particular construct is a problem, I reckon #if defined(assert) && defined(NDEBUG)
# error "..."
#endif
#undef NDEBUG
/* ... */would still be one in at least some cases.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds reasonable. Specifically it fails to build due to some duplicate definition. One due to some MingW headers, another due to some potential Windows macros. But mostly, the trick of including the C file to avoid exporting symbols works well if you include the C file as soon as possible. I'll do the change. Possibly also some new tests came out, I'll add required changes if needed. |
||
| #endif | ||
|
|
||
| #include <config.h> | ||
|
|
||
| #include <freetds/bool.h> | ||
| #include <freetds/macros.h> | ||
|
|
||
| /* | ||
| * Tests should define test_main in lieu of main so that they can be | ||
| * configured to suppress automation-unfriendly crash dialog boxes on | ||
| * Windows. To that end, they can use the TEST_MAIN macro, which cleanly | ||
| * avoids warnings for the tests that ignore their arguments (but still | ||
| * provides the details under conventional names for the remainder). | ||
| */ | ||
| int test_main(int argc, char **argv); | ||
|
|
||
| #define TEST_MAIN() int test_main(int argc TDS_UNUSED, char **argv TDS_UNUSED) | ||
|
|
||
|
|
||
| typedef struct | ||
| { | ||
| char SERVER[512]; | ||
| char DATABASE[512]; | ||
| char USER[512]; | ||
| char PASSWORD[512]; | ||
| char DRIVER[1024]; /* ODBC-only */ | ||
| char CHARSET[512]; | ||
| int maxlength; | ||
| bool fverbose; | ||
| bool initialized; | ||
| bool tried_env; | ||
| } COMMON_PWD; | ||
|
|
||
| extern COMMON_PWD common_pwd; | ||
|
|
||
| #define DEFAULT_PWD_PATH "../../../PWD" | ||
|
|
||
| void reset_login_info(COMMON_PWD * common_pwd); | ||
|
|
||
| /* | ||
| * Both return the path used (favoring $TDSPWDFILE in the absence of | ||
| * tried_env) on success or NULL on failure (silently in the case of | ||
| * try_read_login_info), and defer to any existing settings from | ||
| * e.g. the command line. | ||
| */ | ||
| const char * read_login_info_base(COMMON_PWD * common_pwd, | ||
| const char * default_path); | ||
| const char * try_read_login_info_base(COMMON_PWD * common_pwd, | ||
| const char * default_path); | ||
|
|
||
| #endif /* _tdsguard_afBM6E9n8CuIFSBHNNblq5 */ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add copyright lines.