Add copyright headers and use mbed error to skip tests without network config files

pull/4795/head
Sarah Marsh 2017-08-07 13:13:03 -05:00
parent c68b5a6c93
commit 6a44ceb094
16 changed files with 291 additions and 23 deletions

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity.h" #include "unity.h"

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity.h" #include "unity.h"

View File

@ -1,18 +1,24 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may
* you may not use this file except in compliance with the License. * not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity.h" #include "unity.h"

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include <algorithm> #include <algorithm>
#include "mbed.h" #include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE #include MBED_CONF_APP_HEADER_FILE

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE #include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h" #include "TCPSocket.h"

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Parallel tests are not supported by default #error [NOT_SUPPORTED] Parallel tests are not supported by default
#endif #endif

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include <algorithm> #include <algorithm>
#include "mbed.h" #include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE #include MBED_CONF_APP_HEADER_FILE

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Pressure tests are not supported by default #error [NOT_SUPPORTED] Pressure tests are not supported by default
#endif #endif

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Parallel pressure tests are not supported by default #error [NOT_SUPPORTED] Parallel pressure tests are not supported by default
#endif #endif

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE #include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h" #include "UDPSocket.h"

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h" #include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE #include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h" #include "UDPSocket.h"

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Parallel tests are not supported by default #error [NOT_SUPPORTED] Parallel tests are not supported by default
#endif #endif

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Pressure tests are not supported by default #error [NOT_SUPPORTED] Pressure tests are not supported by default
#endif #endif

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_EXTENDED_TESTS #ifndef MBED_EXTENDED_TESTS
#error [NOT_SUPPORTED] Parallel pressure tests are not supported by default #error [NOT_SUPPORTED] Parallel pressure tests are not supported by default
#endif #endif

View File

@ -137,13 +137,10 @@ if __name__ == '__main__':
"Currently set search path: %s" "Currently set search path: %s"
% (toolchain, search_path)) % (toolchain, search_path))
# boolean, true if test configuration file is for module false if mbed-os interface
module_conf = False
# Assign config file. Precedence: test_config>app_config # Assign config file. Precedence: test_config>app_config
# TODO: merge configs if both given # TODO: merge configs if both given
if options.test_config: if options.test_config:
config, module_conf = get_test_config(options.test_config, mcu) config = get_test_config(options.test_config, mcu)
if not config: if not config:
args_error(parser, "argument --test-config contains invalid path or identifier") args_error(parser, "argument --test-config contains invalid path or identifier")
elif not options.app_config: elif not options.app_config:
@ -154,8 +151,7 @@ if __name__ == '__main__':
# Find all tests in the relevant paths # Find all tests in the relevant paths
for path in all_paths: for path in all_paths:
all_tests.update(find_tests(path, mcu, toolchain, all_tests.update(find_tests(path, mcu, toolchain,
app_config=config, app_config=config))
module_config=module_conf))
# Filter tests by name if specified # Filter tests by name if specified
if options.names: if options.names:

View File

@ -2009,11 +2009,11 @@ def get_test_config(config_name, target_name):
# If they passed in a full path # If they passed in a full path
if exists(config_name): if exists(config_name):
# This is a module config # This is a module config
return config_name, True return config_name
# Otherwise find the path to configuration file based on mbed OS interface # Otherwise find the path to configuration file based on mbed OS interface
return TestConfig.get_config_path(config_name, target_name), False return TestConfig.get_config_path(config_name, target_name)
def find_tests(base_dir, target_name, toolchain_name, app_config=None, module_config=None): def find_tests(base_dir, target_name, toolchain_name, app_config=None):
""" Finds all tests in a directory recursively """ Finds all tests in a directory recursively
base_dir: path to the directory to scan for tests (ex. 'path/to/project') base_dir: path to the directory to scan for tests (ex. 'path/to/project')
target_name: name of the target to use for scanning (ex. 'K64F') target_name: name of the target to use for scanning (ex. 'K64F')
@ -2024,8 +2024,6 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None, module_co
tests = {} tests = {}
configs = TestConfig.get_valid_configs(target_name)
# Prepare the toolchain # Prepare the toolchain
toolchain = prepare_toolchain([base_dir], None, target_name, toolchain_name, toolchain = prepare_toolchain([base_dir], None, target_name, toolchain_name,
silent=True, app_config=app_config) silent=True, app_config=app_config)
@ -2053,11 +2051,6 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None, module_co
test_group_directory_path, test_case_directory = os.path.split(d) test_group_directory_path, test_case_directory = os.path.split(d)
test_group_directory = os.path.basename(test_group_directory_path) test_group_directory = os.path.basename(test_group_directory_path)
# If the target has no network interface configuration, netsocket tests fail to compile
if not module_config and not configs and \
(test_case_directory == 'netsocket' or test_group_directory == 'netsocket'):
continue
# Check to make sure discoverd folder is not in a host test directory # Check to make sure discoverd folder is not in a host test directory
if test_case_directory != 'host_tests' and test_group_directory != 'host_tests': if test_case_directory != 'host_tests' and test_group_directory != 'host_tests':
test_name = test_path_to_name(d, base_dir) test_name = test_path_to_name(d, base_dir)