Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ca8b969 authored by William Escande's avatar William Escande
Browse files

Mock static initialization order 07

cpp static order initialization is not guarantee.
In order to avoid the mess, we need to have a lazy init schema.
Replacing all mock_stack extern with the correct header
```
's|extern std::map<std::string, int> mock_function_count_map;|#include "test/common/mock_functions.h"|'
```

Bug: 265217208
Test: atest --host
Change-Id: I66c4be7432a651dd53e74e31181b778fc2c889b2
parent 22f75a70
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -20,8 +20,7 @@


#include "stack/avdt/avdt_int.h"
#include "stack/avdt/avdt_int.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_hdr.h"

#include "test/common/mock_functions.h"
extern std::map<std::string, int> mock_function_count_map;


/*
/*
 * TODO: This way of mocking is primitive.
 * TODO: This way of mocking is primitive.
+3 −4
Original line number Original line Diff line number Diff line
@@ -19,19 +19,18 @@
 *   Functions generated:9
 *   Functions generated:9
 */
 */


#include <string.h>

#include <map>
#include <map>
#include <string>
#include <string>


extern std::map<std::string, int> mock_function_count_map;

#include <string.h>

#include "a2dp_api.h"
#include "a2dp_api.h"
#include "avdt_api.h"
#include "avdt_api.h"
#include "bt_target.h"
#include "bt_target.h"
#include "osi/include/log.h"
#include "osi/include/log.h"
#include "sdpdefs.h"
#include "sdpdefs.h"
#include "stack/a2dp/a2dp_int.h"
#include "stack/a2dp/a2dp_int.h"
#include "test/common/mock_functions.h"
#include "types/raw_address.h"
#include "types/raw_address.h"


#ifndef UNUSED_ATTR
#ifndef UNUSED_ATTR
+4 −5
Original line number Original line Diff line number Diff line
@@ -19,14 +19,12 @@
 *   Functions generated:67
 *   Functions generated:67
 */
 */


#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

#include <base/logging.h>
#include <base/logging.h>
#include <inttypes.h>
#include <inttypes.h>


#include <map>
#include <string>

#include "a2dp_aac.h"
#include "a2dp_aac.h"
#include "a2dp_codec_api.h"
#include "a2dp_codec_api.h"
#include "a2dp_sbc.h"
#include "a2dp_sbc.h"
@@ -35,6 +33,7 @@ extern std::map<std::string, int> mock_function_count_map;
#include "osi/include/log.h"
#include "osi/include/log.h"
#include "osi/include/properties.h"
#include "osi/include/properties.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_hdr.h"
#include "test/common/mock_functions.h"


#ifndef UNUSED_ATTR
#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#define UNUSED_ATTR
+0 −2
Original line number Original line Diff line number Diff line
@@ -25,8 +25,6 @@
#include <map>
#include <map>
#include <string>
#include <string>


extern std::map<std::string, int> mock_function_count_map;

// Mock include file to share data between tests and mock
// Mock include file to share data between tests and mock
#include "test/mock/mock_stack_a2dp_sbc.h"
#include "test/mock/mock_stack_a2dp_sbc.h"


+1 −2
Original line number Original line Diff line number Diff line
@@ -27,8 +27,6 @@
#include <map>
#include <map>
#include <string>
#include <string>


extern std::map<std::string, int> mock_function_count_map;

// Original included files, if any
// Original included files, if any
// NOTE: Since this is a mock file with mock definitions some number of
// NOTE: Since this is a mock file with mock definitions some number of
//       include files may not be required.  The include-what-you-use
//       include files may not be required.  The include-what-you-use
@@ -45,6 +43,7 @@ extern std::map<std::string, int> mock_function_count_map;
#include "osi/include/log.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/osi.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_hdr.h"
#include "test/common/mock_functions.h"
#include "utils/include/bt_utils.h"
#include "utils/include/bt_utils.h"


// Original usings
// Original usings
Loading