From 026594e269c6bf30e4d69103717d969fc0b3531d Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 6 Aug 2012 21:52:44 +0200 Subject: [PATCH 1/4] Return !0 when qt tests fail. --- src/qt/test/test_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 5b11e39ea37..af2d358fc47 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -6,6 +6,11 @@ // This is all you need to run all the tests int main(int argc, char *argv[]) { + bool fInvalid = false; + URITests test1; - QTest::qExec(&test1); + if (QTest::qExec(&test1) != 0) + fInvalid = true; + + return fInvalid; } From 319236afa221b571b372d3a1eee4a635f9b53976 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 7 Aug 2012 16:43:58 +0200 Subject: [PATCH 2/4] Fix Win32 compiling of qt/test/uritests.cpp --- src/qt/test/uritests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp index a281c39ca56..4662f5ed31c 100644 --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -47,7 +47,7 @@ void URITests::uriTests() uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=100&label=Wikipedia Example")); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W")); - QVERIFY(rv.amount == 10000000000); + QVERIFY(rv.amount == 10000000000LL); QVERIFY(rv.label == QString("Wikipedia Example")); uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address")); From 2bc15836bead1d5bdb8eca2db2525a9643cc4d0f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 7 Aug 2012 19:19:14 +0200 Subject: [PATCH 3/4] Fix Qt test cases by moving address checks to parseBitcoinURI Makes sense in case bitcoin URIs eventually allow invalid addresses as a part of some larger future payment scheme. --- src/qt/guiutil.cpp | 6 ------ src/qt/sendcoinsdialog.cpp | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 558eff6d5d7..d2d7716dbd7 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -4,7 +4,6 @@ #include "bitcoinunits.h" #include "util.h" #include "init.h" -#include "base58.h" #include #include @@ -81,11 +80,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) if(uri.scheme() != QString("bitcoin")) return false; - // check if the address is valid - CBitcoinAddress addressFromUri(uri.path().toStdString()); - if (!addressFromUri.IsValid()) - return false; - SendCoinsRecipient rv; rv.address = uri.path(); rv.amount = 0; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 2c46ea5a703..789681ad900 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -7,6 +7,7 @@ #include "sendcoinsentry.h" #include "guiutil.h" #include "askpassphrasedialog.h" +#include "base58.h" #include #include @@ -273,6 +274,9 @@ bool SendCoinsDialog::handleURI(const QString &uri) // URI has to be valid if (GUIUtil::parseBitcoinURI(uri, &rv)) { + CBitcoinAddress address(rv.address.toStdString()); + if (!address.IsValid()) + return false; pasteEntry(rv); return true; } From c5f90cd88b61ff28327eed4981903bdf72027cc5 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 7 Aug 2012 22:55:07 +0200 Subject: [PATCH 4/4] Fix test_bitcoin build in makefile.linux-mingw --- src/makefile.linux-mingw | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index fc22bb76ee6..51439c7b7c8 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -7,11 +7,12 @@ DEPSDIR:=/usr/i586-mingw32msvc USE_UPNP:=0 INCLUDEPATHS= \ + -I"$(CURDIR)" \ + -I"$(CURDIR)"/obj \ -I"$(DEPSDIR)/boost_1_49_0" \ -I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ -I"$(DEPSDIR)/openssl-1.0.1b/include" \ - -I"$(DEPSDIR)" \ - -I"$(CURDIR)"/obj \ + -I"$(DEPSDIR)" LIBPATHS= \ -L"$(DEPSDIR)/boost_1_49_0/stage/lib" \ @@ -88,7 +89,7 @@ obj-test/%.o: test/%.cpp $(HEADERS) i586-mingw32msvc-g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $< test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) - i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework $(LIBS) + i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework-mt-s $(LIBS) clean: