Skip to content

Commit bda2d37

Browse files
author
Antti Kauppila
committed
Unittests fixed
PRs 12051 and 11996 were merged simultaneously without running tests in between. This caused unittests to brake and those are fixed with this commit.
1 parent f10e4ac commit bda2d37

File tree

7 files changed

+46
-13
lines changed

7 files changed

+46
-13
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularinformation/unittest.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@ set(unittest-test-sources
3434
stubs/NetworkInterface_stub.cpp
3535
stubs/NetworkInterfaceDefaults_stub.cpp
3636
stubs/Mutex_stub.cpp
37+
stubs/Semaphore_stub.cpp
38+
)
39+
40+
set(unittest-test-flags
41+
-DDEVICE_SERIAL=1
42+
-DDEVICE_INTERRUPTIN=1
3743
)

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/unittest.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@ set(unittest-test-sources
3636
stubs/randLIB_stub.cpp
3737
stubs/ConditionVariable_stub.cpp
3838
stubs/Mutex_stub.cpp
39+
stubs/Semaphore_stub.cpp
40+
)
41+
42+
set(unittest-test-flags
43+
-DDEVICE_SERIAL=1
44+
-DDEVICE_INTERRUPTIN=1
3945
)

UNITTESTS/features/cellular/framework/AT/at_cellularsms/unittest.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ set(unittest-test-sources
3737
stubs/NetworkInterface_stub.cpp
3838
stubs/NetworkInterfaceDefaults_stub.cpp
3939
stubs/Mutex_stub.cpp
40+
stubs/Semaphore_stub.cpp
4041
)
4142

4243
set(unittest-test-flags
4344
-DMBED_CONF_CELLULAR_USE_SMS=1
45+
-DDEVICE_SERIAL=1
46+
-DDEVICE_INTERRUPTIN=1
4447
)

UNITTESTS/features/cellular/framework/AT/at_cellularstack/unittest.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,11 @@ set(unittest-test-sources
4343
stubs/ThisThread_stub.cpp
4444
stubs/ConditionVariable_stub.cpp
4545
stubs/Mutex_stub.cpp
46+
stubs/Semaphore_stub.cpp
4647
)
48+
49+
set(unittest-test-flags
50+
-DDEVICE_SERIAL=1
51+
-DDEVICE_INTERRUPTIN=1
52+
)
53+

UNITTESTS/stubs/AT_CellularDevice_stub.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ int AT_CellularDevice_stub::get_sim_failure_count = 0;
3232
bool AT_CellularDevice_stub::pin_needed = false;
3333
bool AT_CellularDevice_stub::supported_bool = false;
3434

35-
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _network(0), _sms(0),
35+
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh),
36+
#if MBED_CONF_CELLULAR_USE_SMS
37+
_sms(0),
38+
#endif // MBED_CONF_CELLULAR_USE_SMS
39+
_network(0),
3640
_information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT), _modem_debug_on(false)
3741
{
3842
}
@@ -87,12 +91,23 @@ CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)
8791
_modem_debug_on), *this);
8892
return _network;
8993
}
90-
94+
#if MBED_CONF_CELLULAR_USE_SMS
9195
CellularSMS *AT_CellularDevice::open_sms(FileHandle *fh)
9296
{
9397
return NULL;
9498
}
9599

100+
void AT_CellularDevice::close_sms()
101+
{
102+
}
103+
104+
AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at)
105+
{
106+
return NULL;
107+
}
108+
109+
#endif // MBED_CONF_CELLULAR_USE_SMS
110+
96111
CellularInformation *AT_CellularDevice::open_information(FileHandle *fh)
97112
{
98113
return NULL;
@@ -108,10 +123,6 @@ void AT_CellularDevice::close_network()
108123
}
109124
}
110125

111-
void AT_CellularDevice::close_sms()
112-
{
113-
}
114-
115126
void AT_CellularDevice::close_information()
116127
{
117128
}
@@ -142,11 +153,6 @@ AT_CellularNetwork *AT_CellularDevice::open_network_impl(ATHandler &at)
142153
return _network;
143154
}
144155

145-
AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at)
146-
{
147-
return NULL;
148-
}
149-
150156
AT_CellularInformation *AT_CellularDevice::open_information_impl(ATHandler &at)
151157
{
152158
return NULL;

UNITTESTS/stubs/CellularDevice_stub.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
3737
}
3838
}
3939

40-
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0),
41-
_info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0)
40+
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0),
41+
#if MBED_CONF_CELLULAR_USE_SMS
42+
_sms_ref_count(0),
43+
#endif //MBED_CONF_CELLULAR_USE_SMS
44+
_info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0),
45+
_nw(0), _status_cb(0), _property_array(0)
4246
{
4347
}
4448

UNITTESTS/target_h/myCellularDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "ATHandler_stub.h"
2424
#include "AT_CellularContext.h"
2525
#include "gtest/gtest.h"
26+
#include "UARTSerial.h"
2627

2728
using namespace events;
2829

0 commit comments

Comments
 (0)