Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Revision 23:408199b5d2cb, committed 2012-09-05
- Comitter:
- ashleymills
- Date:
- Wed Sep 05 16:38:06 2012 +0000
- Parent:
- 22:5b1feecf2aeb
- Child:
- 24:8f0f9551122a
- Child:
- 28:c630a04a7198
- Commit message:
- Added internet test.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPClientLib.lib Wed Sep 05 16:38:06 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPClientLib/#791fc3dcb6c4
--- a/TestManager.cpp Wed Sep 05 14:47:44 2012 +0000 +++ b/TestManager.cpp Wed Sep 05 16:38:06 2012 +0000 @@ -2,25 +2,28 @@ #include "Tests.h" TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) { // using direct array indexing instead of searching each time, so need to put in dummy tests - for(int i=0; i<12; i++) { - _tests.push_back(NULL); - } + for(int i=0; i<10; i++) { _tests.push_back(NULL); } + + _tests.push_back((VodafoneTestCase*)new Test10(_modem,10)); + + for(int i=11; i<12; i++) { _tests.push_back(NULL); } + _tests.push_back((VodafoneTestCase*)new Test12(_modem,12)); _tests.push_back((VodafoneTestCase*)new Test13(_modem,13)); - for(int i=14; i<21; i++) { - _tests.push_back(NULL); - } + + for(int i=14; i<21; i++) { _tests.push_back(NULL); } + _tests.push_back((VodafoneTestCase*)new Test21(_modem,21)); _tests.push_back((VodafoneTestCase*)new Test22(_modem,22)); _tests.push_back((VodafoneTestCase*)new Test23(_modem,23)); - for(int i=24; i<25; i++) { - _tests.push_back(NULL); - } + + for(int i=24; i<25; i++) { _tests.push_back(NULL); } + _tests.push_back((VodafoneTestCase*)new Test25(_modem,25)); _tests.push_back((VodafoneTestCase*)new Test26(_modem,26)); - for(int i=27; i<50; i++) { - _tests.push_back(NULL); - } + + for(int i=27; i<50; i++) { _tests.push_back(NULL); } + _tests.push_back((VodafoneTestCase*)new Test50(_modem,50)); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tests/Test10.h Wed Sep 05 16:38:06 2012 +0000 @@ -0,0 +1,41 @@ +#pragma once +#include "VodafoneTestCase.h" +#include "HTTPClient.h" +class Test10 : public VodafoneTestCase { + public: + Test10(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { + } + + virtual void setupTest() { + + + } + + virtual bool runTest() { + HTTPClient http; + char msgBuffer[125]; + bool outcome = false; + + LOG("Connecting to internet"); + if(_modem->connect("internet","web","web")==0) { + LOG("Connected to internet"); + } else { + LOG("Failed to connect to internet"); + } + + LOG("Test %d, retrieving a 5MB file via HTTP.", _testCaseNumber); + if(http.get("http://www.m2mthings.com/test100.txt", msgBuffer, 125)==0) { + LOG("Got %s",msgBuffer); + outcome = true; + } + _modem->disconnect(); + return outcome; + } + + virtual void endTest() { + + } + + private: + +}; \ No newline at end of file
--- a/Tests/Test25.h Wed Sep 05 14:47:44 2012 +0000 +++ b/Tests/Test25.h Wed Sep 05 16:38:06 2012 +0000 @@ -6,7 +6,7 @@ } virtual void setupTest() { - _ussdResponse = (char*)malloc(16*sizeof(char)); + } virtual bool runTest() { @@ -28,7 +28,6 @@ case LinkMonitor::REGISTRATION_STATE_UNKNOWN: LOG("regState: UNKNOWN. Failing."); return false; - break; case LinkMonitor::REGISTRATION_STATE_REGISTERING: LOG("regState: REGISTERING"); break; @@ -47,14 +46,12 @@ default: LOG("regState: ERROR. Failing."); return false; - break; } switch(bearer) { case LinkMonitor::BEARER_UNKNOWN: LOG("bearer: UNKNOWN. Failing."); return false; - break; case LinkMonitor::BEARER_GSM: LOG("bearer: GSM"); break; @@ -73,7 +70,6 @@ default: LOG("bearer: ERROR. Failing."); return false; - break; } } else { @@ -84,9 +80,9 @@ } virtual void endTest() { - free(_ussdResponse); + } private: - char *_ussdResponse; + };
--- a/Tests/Test26.h Wed Sep 05 14:47:44 2012 +0000 +++ b/Tests/Test26.h Wed Sep 05 16:38:06 2012 +0000 @@ -6,7 +6,7 @@ } virtual void setupTest() { - _ussdResponse = (char*)malloc(16*sizeof(char)); + } virtual bool runTest() { @@ -29,7 +29,6 @@ case LinkMonitor::REGISTRATION_STATE_UNKNOWN: LOG("regState: UNKNOWN. Failing."); return false; - break; case LinkMonitor::REGISTRATION_STATE_REGISTERING: LOG("regState: REGISTERING"); break; @@ -48,14 +47,12 @@ default: LOG("regState: ERROR. Failing."); return false; - break; } switch(bearer) { case LinkMonitor::BEARER_UNKNOWN: LOG("bearer: UNKNOWN. Failing."); return false; - break; case LinkMonitor::BEARER_GSM: LOG("bearer: GSM"); break; @@ -74,7 +71,6 @@ default: LOG("bearer: ERROR. Failing."); return false; - break; } } else { return false; @@ -85,10 +81,10 @@ } virtual void endTest() { - free(_ussdResponse); + } private: - char *_ussdResponse; + };
--- a/Tests/Tests.h Wed Sep 05 14:47:44 2012 +0000 +++ b/Tests/Tests.h Wed Sep 05 16:38:06 2012 +0000 @@ -1,4 +1,5 @@ #pragma once +#include "Test10.h" #include "Test12.h" #include "Test13.h" #include "Test21.h" @@ -8,12 +9,12 @@ #include "Test26.h" #include "Test50.h" -static const int gAllTests[] = {12,13,21,22,23,25,26,50}; -static const int gNumAllTests = 8; -static const int gAutomatedTests[] = {21,22,23,25}; -static const int gNumAutomatedTests = 4; -static const int gInteractiveTests[] = {12,13,26}; -static const int gNumInteractiveTests = 3; +static const int gAllTests[] = {10,12,13,21,22,23,25,26,50}; +static const int gNumAllTests = 9; +static const int gAutomatedTests[] = {10,21,22,23,25,26}; +static const int gNumAutomatedTests = 6; +static const int gInteractiveTests[] = {12,13}; +static const int gNumInteractiveTests = 2; static const int gSoakTests[] = {50}; static const int gNumSoakTests = 1; @@ -32,6 +33,7 @@ (const int*)&gSoakTests }; + static const int gTestProfileLengths[4] = { gNumAllTests, gNumAutomatedTests,
--- a/main.cpp Wed Sep 05 14:47:44 2012 +0000 +++ b/main.cpp Wed Sep 05 16:38:06 2012 +0000 @@ -60,7 +60,7 @@ fprintf(stdout,"Invocation time: %s\r\n",ctime(¤tTime)); - Thread testTask(test, NULL, osPriorityNormal, 1024 * 6); + Thread testTask(test, NULL, osPriorityNormal, 1024 * 8); // this thread just waits and blinks leds periodically while(1) { led1 = !led1;
--- a/mbed.bld Wed Sep 05 14:47:44 2012 +0000 +++ b/mbed.bld Wed Sep 05 16:38:06 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file