Commit 51387de3 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Silently skip Seismic Store tests if OPENZGY_TOKEN is unset.

parent 8bf92485
......@@ -14,6 +14,7 @@
#define CUTEST_HAS_MAIN
#include "test_all.h"
#include "../impl/environment.h"
#include <iostream>
#include <functional>
......@@ -21,6 +22,12 @@
#include <signal.h>
#endif
static bool enable_sd_tests()
{
static bool enabled = InternalZGY::Environment::getStringEnv("OPENZGY_TOKEN") != "";
return enabled;
}
static void do_nothing()
{
}
......@@ -46,6 +53,22 @@ void register_test(const char* name, void (*func)(void))
test_list__[pos].func = func;
}
void register_sd_test(const char* name, void (*func)(void))
{
if (enable_sd_tests())
register_test(name, func);
else {
char *noname = new char[strlen(name)+2];
noname[0] = '~';
// Re-implementing strcpy() because, Windows.
char *cp = &noname[1];
while(*name)
*cp++ = *name++;
*cp++ = '\0';
register_test(noname, do_nothing);
}
}
static int _global_verbose = 0;
/**
......
......@@ -21,4 +21,5 @@
#define NOMINMAX // cutest includes Windows.h. Ugh!
#include "cutest.h"
extern void register_test(const char* name, void (*func)(void));
extern void register_sd_test(const char* name, void (*func)(void));
extern int verbose();
......@@ -2821,9 +2821,9 @@ public:
register_test("api.compress_zfp", test_compress_zfp);
register_test("api.compress_off", test_compress_off);
#ifdef HAVE_SD
register_test("api.write_cloud", test_write_cloud);
register_test("api.write_cloud_mt", test_write_cloud_mt);
register_test("api.alturl", test_alturl);
register_sd_test("api.write_cloud", test_write_cloud);
register_sd_test("api.write_cloud_mt", test_write_cloud_mt);
register_sd_test("api.alturl", test_alturl);
#endif
register_test("api.historange", test_historange);
register_test("api.lod_lowpass", test_lod_lowpass);
......@@ -2844,14 +2844,14 @@ public:
register_test("api.2d", test_2d);
register_test("api.decimate_edge", test_decimate_edge);
#ifdef HAVE_SD
register_test("api.tokencb_destroy", test_tokencb_destroy);
register_test("api.tokencb_normal", test_tokencb_normal);
register_sd_test("api.tokencb_destroy", test_tokencb_destroy);
register_sd_test("api.tokencb_normal", test_tokencb_normal);
#endif
register_test("api.readwrite", test_readwrite_local);
#ifdef HAVE_SD
register_test("api.readwrite_cloud", test_readwrite_cloud);
register_test("api.hammer", test_hammer);
register_test("api.sderrors", test_sderrors);
register_sd_test("api.readwrite_cloud", test_readwrite_cloud);
register_sd_test("api.hammer", test_hammer);
register_sd_test("api.sderrors", test_sderrors);
#endif
register_test("api.edgebricks", test_edgebricks);
register_test("api.bat_local_1", test_bat_local_1);
......@@ -2859,10 +2859,10 @@ public:
register_test("api.bat_local_4", test_bat_local_4);
register_test("api.bat_local_zfp", test_bat_local_zfp);
#ifdef HAVE_SD
register_test("api.bat_sd_1", test_bat_sd_1);
register_test("api.bat_sd_2", test_bat_sd_2);
register_test("api.bat_sd_4", test_bat_sd_4);
register_test("api.bat_sd_zfp", test_bat_sd_zfp);
register_sd_test("api.bat_sd_1", test_bat_sd_1);
register_sd_test("api.bat_sd_2", test_bat_sd_2);
register_sd_test("api.bat_sd_4", test_bat_sd_4);
register_sd_test("api.bat_sd_zfp", test_bat_sd_zfp);
#endif
}
} dummy;
......
......@@ -367,10 +367,10 @@ namespace {
{
register_test("file.localfilefactory", test_localfilefactory);
#ifdef HAVE_SD
register_test("aaa.sdtoken", test_sdtoken);
register_test("file.sdfilefactory", test_sdfilefactory);
register_test("file.sdfiledelete", test_sdfiledelete);
register_test("file.sdreopen", test_sdreopen);
register_sd_test("aaa.sdtoken", test_sdtoken);
register_sd_test("file.sdfilefactory", test_sdfilefactory);
register_sd_test("file.sdfiledelete", test_sdfiledelete);
register_sd_test("file.sdreopen", test_sdreopen);
#endif
}
} dummy;
......
......@@ -2454,9 +2454,9 @@ public:
register_test("reopen.zgypublic", test_reopen_zgypublic);
register_test("reopen.track_changes", test_reopen_track_changes);
#ifdef HAVE_SD
register_test("reopen.plain_sd", test_reopen_plain_sd);
register_test("reopen.sd", test_reopen_sd);
register_test("reopen.zgycloud", test_reopen_zgycloud);
register_sd_test("reopen.plain_sd", test_reopen_plain_sd);
register_sd_test("reopen.sd", test_reopen_sd);
register_sd_test("reopen.zgycloud", test_reopen_zgycloud);
#endif
}
} dummy_reopen;
......
......@@ -165,9 +165,9 @@ namespace {
{
using Test::TestSmallCache;
#ifdef HAVE_SD
register_test("smallcache.regular", TestSmallCache::test_regular);
register_test("smallcache.fewbricks", TestSmallCache::test_fewbricks);
register_test("smallcache.manybricks", TestSmallCache::test_manybricks);
register_sd_test("smallcache.regular", TestSmallCache::test_regular);
register_sd_test("smallcache.fewbricks", TestSmallCache::test_fewbricks);
register_sd_test("smallcache.manybricks", TestSmallCache::test_manybricks);
#endif
}
} dummy;
......
......@@ -45,7 +45,7 @@ ${PIP} install -r ../../build/deploy/pure/requirements.txt
${PIP} install ../../external/ZgyBindings*.whl || true
${PIP} install ../../external/ZgyCompressor*.whl || true
${PIP} install ../../build/deploy/pure/OpenZGY-*.whl
if [ -r ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl ]
if [ -r ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl -a "x${OPENZGY_TOKEN}" != "x" ]
then
${PIP} install ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl
echo "Testing OpenZGY/Python with cloud access for ${MYPLATFORM}"
......
......@@ -39,7 +39,7 @@ ${PIP} install --upgrade setuptools wheel
${PIP} install -r ../../build/deploy/wrapper/requirements.txt
${PIP} install ../../build/deploy/wrapper/${MYPLATFORM}/OpenZgyBindings-*.whl
TESTLIST=local
if [ -r ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl ]
if [ -r ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl -a "x${OPENZGY_TOKEN}" != "x" ]
then
${PIP} install ../../build/deploy/sdglue/${MYPLATFORM}/SdGlue-*.whl
TESTLIST="$TESTLIST sd"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment