diff --git a/test/bench.hpp b/test/bench.hpp index 660aa13..69aff50 100644 --- a/test/bench.hpp +++ b/test/bench.hpp @@ -3,6 +3,10 @@ void benchAddDblG1() { puts("benchAddDblG1"); +#ifndef NDEBUG + puts("skip in debug"); + return; +#endif const int C = 100000; G1 P1, P2, P3; hashAndMapToG1(P1, "a"); @@ -29,6 +33,10 @@ void benchAddDblG1() void benchAddDblG2() { puts("benchAddDblG2"); +#ifndef NDEBUG + puts("skip in debug"); + return; +#endif const int C = 100000; G2 P1, P2, P3; hashAndMapToG2(P1, "a"); @@ -61,6 +69,10 @@ void invAdd(T& out, const T& x, const T& y) void testBench(const G1& P, const G2& Q) { +#ifndef NDEBUG + puts("testBench skip in debug"); + return; +#endif G1 Pa; G2 Qa; Fp12 e1, e2; diff --git a/test/bls12_test.cpp b/test/bls12_test.cpp index ec4204c..e6c691a 100644 --- a/test/bls12_test.cpp +++ b/test/bls12_test.cpp @@ -431,6 +431,10 @@ const char *e1Str = finalExp(e2, e0); // finalExpC(e2, e0); CYBOZU_TEST_EQUAL(e1, e2); +#ifndef NDEBUG + puts("skip bench of finalExp in debug"); + return; +#endif CYBOZU_BENCH_C("finalExp", 100, finalExp, e2, e0); } @@ -685,6 +689,10 @@ void testCurve(const mcl::CurveParam& cp) } CYBOZU_TEST_AUTO(multi) { +#ifndef NDEBUG + puts("skip multi in debug"); + return; +#endif G1 P; G2 Q; int i; @@ -722,6 +730,10 @@ CYBOZU_TEST_AUTO(deserialize) size_t n2 = Q.serialize(buf2, sizeof(buf2)); CYBOZU_TEST_ASSERT(n2 > 0); CYBOZU_TEST_EQUAL(Q.deserialize(buf2, n2), n2); +#ifndef NDEBUG + puts("skip bench in debug"); + return; +#endif for (int i = 0; i < 2; i++) { bool doVerify = i == 0; printf("verifyOrder(%d)\n", doVerify); diff --git a/test/fp_tower_test.cpp b/test/fp_tower_test.cpp index 5dd3a70..3a45618 100644 --- a/test/fp_tower_test.cpp +++ b/test/fp_tower_test.cpp @@ -378,6 +378,10 @@ void testIo() void benchFp2() { puts(__FUNCTION__); +#ifndef NDEBUG + puts("skip bench in debug"); + return; +#endif Fp2 x, y; x.a.setStr("4"); x.b.setStr("464652165165"); diff --git a/test/paillier_test.cpp b/test/paillier_test.cpp index 31d2b26..7bb6e99 100644 --- a/test/paillier_test.cpp +++ b/test/paillier_test.cpp @@ -5,7 +5,11 @@ CYBOZU_TEST_AUTO(paillier) { using namespace mcl::paillier; SecretKey sec; +#ifndef NDEBUG + sec.init(512); +#else sec.init(2048); +#endif PublicKey pub; sec.getPublicKey(pub); mpz_class m1("12342340928409"), m2("23049820498204"); diff --git a/test/she_test.cpp b/test/she_test.cpp index 9ef51c7..f49f29f 100644 --- a/test/she_test.cpp +++ b/test/she_test.cpp @@ -43,6 +43,9 @@ double clk2msec(const cybozu::CpuClock& clk, int n) CYBOZU_TEST_AUTO(bench2) { +#ifndef NDEBUG + puts("skip bench2 in debug"); +#endif puts("msec"); setTryNum(1 << 16); useDecG1ViaGT(true); @@ -571,7 +574,7 @@ CYBOZU_TEST_AUTO(io) } } -#ifndef PAPER +#if !defined(PAPER) && defined(NDEBUG) CYBOZU_TEST_AUTO(bench) { const SecretKey& sec = g_sec;