8000 Bug fix/implement windows maintenance tests by dothebart · Pull Request #9763 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/implement windows maintenance tests #9763

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

Merged
merged 9 commits into from
Aug 21, 2019
Prev Previous commit
Next Next commit
fix rc file generation as sugested by @droneplane, fix loading of JSO…
…N values
  • Loading branch information
dothebart committed Aug 20, 2019
commit 348821c08ba7aef5245ba455704e2c45debc9616
54 changes: 19 additions & 35 deletions tests/Maintenance/MaintenanceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,42 +83,26 @@ LPSTR dbs0Str = nullptr;
LPSTR dbs1Str = nullptr;
LPSTR dbs2Str = nullptr;

int loadResources(void) {
int rc = 0;
printf("10--------\n");

HRSRC myResource = ::FindResource(NULL, MAKEINTRESOURCE(IDS_PLAN), RT_RCDATA);
printf("11--------%p\n", myResource);
LPSTR getResource(int which) {
HRSRC myResource = ::FindResource(NULL, MAKEINTRESOURCE(which), RT_RCDATA);
HGLOBAL myResourceData = ::LoadResource(NULL, myResource);
printf("12--------%p\n", myResourceData);
void* pMyBinaryData = ::LockResource(myResourceData);
printf("13--------%p\n", pMyBinaryData);

DWORD size = SizeofResource(0, myResource);
printf("14--------%d\n", size);
icu::UnicodeString buf = UnicodeString ((const wchar_t *) myResourceData, size);
printf("15--------\n");
std::string uBuf;
printf("16--------\n");
buf.toUTF8String<std::string>(uBuf);
printf("17--------\n");
printf(uBuf.c_str());
printf("18--------\n");
/*
rc += LoadStringA(GetModuleHandle(nullptr), IDS_PLAN, planStr, 0);
printf("2--------\n");
rc += LoadStringA(GetModuleHandle(nullptr), IDS_CURRENT, currentStr, 0);
printf("3--------\n");
rc += LoadStringA(GetModuleHandle(nullptr), IDS_DBSERVER0001, dbs0Str, 0);
printf("4--------\n");
rc += LoadStringA(GetModuleHandle(nullptr), IDS_DBSERVER0002, dbs1Str, 0);
printf("5--------\n");
rc += LoadStringA(GetModuleHandle(nullptr), IDS_DBSERVER0003, dbs2Str, 0);
printf("6--------\n");
rc += LoadStringA(GetModuleHandle(nullptr), IDS_SUPERVISION, supervisionStr, 0);
printf("7--------\n");
*/
return rc;
return (LPSTR) ::LockResource(myResourceData);
}
int loadResources(void) {
if ((planStr == nullptr) &&
(currentStr == nullptr) &&
(supervisionStr == nullptr) &&
(dbs0Str == nullptr) &&
(dbs1Str == nullptr) &&
(dbs2Str == nullptr)) {
planStr = getResource(IDS_PLAN);
currentStr = getResource(IDS_CURRENT);
dbs0Str = getResource(IDS_DBSERVER0001);
dbs1Str = getResource(IDS_DBSERVER0002);
dbs2Str = getResource(IDS_DBSERVER0003);
supervisionStr = getResource(IDS_SUPERVISION);
}
return 0;
}

#endif // _WIN32
Expand Down
4 changes: 2 additions & 2 deletions tests/Maintenance/generateRcFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ done
for JSON in *.json ; do
RCNAME="IDS_$(echo "${JSON}"|sed -e "s;.json;;" -e 's/\(.*\)/\U\1/')"

printf "${RCNAME}, RCDATA\r\n{\r\n"
printf "${RCNAME} RCDATA\r\n{\r\n"
# first cut off the .h related syntax...
cat "${JSON}" |sed -e 's;^R"=($;;' -e 's;^)="$;;' | \
sed -e 's;";"";g' -e 's;^; ";' -e 's;$;",;'
# then escape quotes (by doubling them) and pre & post pend quotes.
printf "}\r\n"
printf '"\\0"\r\n}\r\n'
done
printf "\r\n}\r\n"
) > json.rc
18 changes: 12 additions & 6 deletions tests/Maintenance/json.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define IDS_DBSERVER0003 4
#define IDS_PLAN 5
#define IDS_SUPERVISION 6
IDS_CURRENT, RCDATA
IDS_CURRENT RCDATA
{
"",
"{",
Expand Down Expand Up @@ -1982,8 +1982,9 @@ IDS_CURRENT, RCDATA
" }",
"}",
"",
"\0"
}
IDS_DBSERVER0001, RCDATA
IDS_DBSERVER0001 RCDATA
{
"",
"{",
Expand Down Expand Up @@ -4891,8 +4892,9 @@ IDS_DBSERVER0001, RCDATA
" }",
"}",
"",
"\0"
}
IDS_DBSERVER0002, RCDATA
IDS_DBSERVER0002 RCDATA
{
"",
"{",
Expand Down Expand Up @@ -6503,8 +6505,9 @@ IDS_DBSERVER0002, RCDATA
" }",
"}",
"",
"\0"
}
IDS_DBSERVER0003, RCDATA
IDS_DBSERVER0003 RCDATA
{
"",
"{",
Expand Down Expand Up @@ -9391,8 +9394,9 @@ IDS_DBSERVER0003, RCDATA
" }",
"}",
"",
"\0"
}
IDS_PLAN, RCDATA
IDS_PLAN RCDATA
{
"",
"{",
Expand Down Expand Up @@ -10806,8 +10810,9 @@ IDS_PLAN, RCDATA
" ""Lock"": ""UNLOCKED""",
"}",
"",
"\0"
}
IDS_SUPERVISION, RCDATA
IDS_SUPERVISION RCDATA
{
"",
"{",
Expand Down Expand Up @@ -10866,6 +10871,7 @@ IDS_SUPERVISION, RCDATA
" }",
"}",
"",
"\0"
}

}
0