From d9efbc3698f92b874abb6eff3298c44fd35b0d5c Mon Sep 17 00:00:00 2001 From: David Steele Date: Sat, 18 Jan 2020 10:46:48 -0700 Subject: [PATCH] Add UTF8 strings to manifest and restore tests. The most likely place to get UTF8 characters is in database names so make sure UTF8 works in the places where database names are processed. --- test/src/module/command/restoreTest.c | 11 ++++++++--- test/src/module/info/manifestTest.c | 12 ++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/test/src/module/command/restoreTest.c b/test/src/module/command/restoreTest.c index ddf7a7886..b9c5d474a 100644 --- a/test/src/module/command/restoreTest.c +++ b/test/src/module/command/restoreTest.c @@ -14,6 +14,11 @@ Test Restore Command #include "common/harnessInfo.h" #include "common/harnessStorage.h" +/*********************************************************************************************************************************** +Special string constants +***********************************************************************************************************************************/ +#define UTF8_DB_NAME "这个用汉语怎么说" + /*********************************************************************************************************************************** Test data for backup.info ***********************************************************************************************************************************/ @@ -1050,7 +1055,7 @@ testRun(void) strLstAddZ(argListClean, "--pg1-path=/pg"); StringList *argList = strLstDup(argListClean); - strLstAddZ(argList, "--db-include=test1"); + strLstAddZ(argList, "--db-include=" UTF8_DB_NAME); harnessCfgLoad(cfgCmdRestore, argList); Manifest *manifest = NULL; @@ -1078,13 +1083,13 @@ testRun(void) manifestDbAdd(manifest, &(ManifestDb){.name = STRDEF("postgres"), .id = 12173, .lastSystemId = 12168}); manifestDbAdd(manifest, &(ManifestDb){.name = STRDEF("template0"), .id = 12168, .lastSystemId = 12168}); manifestDbAdd(manifest, &(ManifestDb){.name = STRDEF("template1"), .id = 1, .lastSystemId = 12168}); - manifestDbAdd(manifest, &(ManifestDb){.name = STRDEF("test1"), .id = 16384, .lastSystemId = 12168}); + manifestDbAdd(manifest, &(ManifestDb){.name = STRDEF(UTF8_DB_NAME), .id = 16384, .lastSystemId = 12168}); manifestFileAdd( manifest, &(ManifestFile){.name = STRDEF(MANIFEST_TARGET_PGDATA "/" PG_PATH_BASE "/1/" PG_FILE_PGVERSION)}); } MEM_CONTEXT_END(); - TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to include 'test1' does not exist"); + TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to include '" UTF8_DB_NAME "' does not exist"); TEST_RESULT_LOG("P00 DETAIL: databases found for selective restore (1)"); diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c index 7d6b2283e..f4d698e38 100644 --- a/test/src/module/info/manifestTest.c +++ b/test/src/module/info/manifestTest.c @@ -10,6 +10,11 @@ Test Backup Manifest Handler #include "common/harnessInfo.h" +/*********************************************************************************************************************************** +Special string constants +***********************************************************************************************************************************/ +#define SHRUG_EMOJI "¯\\_(ツ)_/¯" + /*********************************************************************************************************************************** Test Run ***********************************************************************************************************************************/ @@ -1657,6 +1662,7 @@ testRun(void) "postgres={\"db-id\":12173,\"db-last-system-id\":12168}\n" \ "template0={\"db-id\":12168,\"db-last-system-id\":12168}\n" \ "template1={\"db-id\":1,\"db-last-system-id\":12168}\n" \ + SHRUG_EMOJI "={\"db-id\":18000,\"db-last-system-id\":12168}\n" #define TEST_MANIFEST_FILE \ "\n" \ @@ -1780,6 +1786,12 @@ testRun(void) varLstAdd(dbRow, varNewUInt64(12168)); varLstAdd(dbList, varNewVarLst(dbRow)); + dbRow = varLstNew(); + varLstAdd(dbRow, varNewUInt64(18000)); + varLstAdd(dbRow, varNewStrZ(SHRUG_EMOJI)); + varLstAdd(dbRow, varNewUInt64(12168)); + varLstAdd(dbList, varNewVarLst(dbRow)); + TEST_RESULT_VOID( manifestBuildComplete( manifest, 1565282140, STRDEF("285/89000028"), STRDEF("000000030000028500000089"), 1565282142,