tests: Ensure that executable and library are named differently

On Windows, the basename is used to determine the name of the PDB
file. So for a project called myproject, we will create myproject.dll
and myproject.exe, both of which will have myproject.pdb. This is
a file collision. Instead, append `_test`, similar to the C# template.

Fixes AllPlatformTest.test_templates on MSVC. This became a hard error
when we started listing PDBs in the implicit outputs list of ninja
targets.

Do the same for a test that was making the same mistake.
pull/6637/head
Nirbheek Chauhan 5 years ago
parent be486a2ec8
commit 7f1d78f304
  1. 3
      mesonbuild/templates/cpptemplates.py
  2. 3
      mesonbuild/templates/ctemplates.py
  3. 3
      mesonbuild/templates/cudatemplates.py
  4. 3
      mesonbuild/templates/dlangtemplates.py
  5. 3
      mesonbuild/templates/fortrantemplates.py
  6. 1
      mesonbuild/templates/javatemplates.py
  7. 3
      mesonbuild/templates/objcpptemplates.py
  8. 3
      mesonbuild/templates/objctemplates.py
  9. 3
      mesonbuild/templates/rusttemplates.py
  10. 2
      test cases/common/149 recursive linking/3rdorderdeps/meson.build

@ -153,6 +153,7 @@ def create_lib_cpp_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
class_name = uppercase_token[0] + lowercase_token[1:]
test_exe_name = lowercase_token + '_test'
namespace = lowercase_token
lib_hpp_name = lowercase_token + '.hpp'
lib_cpp_name = lowercase_token + '.cpp'
@ -165,7 +166,7 @@ def create_lib_cpp_sample(project_name, version):
'header_file': lib_hpp_name,
'source_file': lib_cpp_name,
'test_source_file': test_cpp_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -134,6 +134,7 @@ def create_lib_c_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_h_name = lowercase_token + '.h'
lib_c_name = lowercase_token + '.c'
test_c_name = lowercase_token + '_test.c'
@ -144,7 +145,7 @@ def create_lib_c_sample(project_name, version):
'header_file': lib_h_name,
'source_file': lib_c_name,
'test_source_file': test_c_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -153,6 +153,7 @@ def create_lib_cuda_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
class_name = uppercase_token[0] + lowercase_token[1:]
test_exe_name = lowercase_token + '_test'
namespace = lowercase_token
lib_h_name = lowercase_token + '.h'
lib_cuda_name = lowercase_token + '.cu'
@ -165,7 +166,7 @@ def create_lib_cuda_sample(project_name, version):
'header_file': lib_h_name,
'source_file': lib_cuda_name,
'test_source_file': test_cuda_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -113,6 +113,7 @@ def create_lib_d_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_m_name = lowercase_token
lib_d_name = lowercase_token + '.d'
test_d_name = lowercase_token + '_test.d'
@ -123,7 +124,7 @@ def create_lib_d_sample(project_name, version):
'module_file': lib_m_name,
'source_file': lib_d_name,
'test_source_file': test_d_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -111,6 +111,7 @@ def create_lib_fortran_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_fortran_name = lowercase_token + '.f90'
test_fortran_name = lowercase_token + '_test.f90'
kwargs = {'utoken': uppercase_token,
@ -119,7 +120,7 @@ def create_lib_fortran_sample(project_name, version):
'function_name': function_name,
'source_file': lib_fortran_name,
'test_source_file': test_fortran_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -118,7 +118,6 @@ def create_lib_java_sample(project_name, version):
'class_name': class_name,
'source_file': lib_java_name,
'test_source_file': test_java_name,
'test_exe_name': lowercase_token,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -134,6 +134,7 @@ def create_lib_objcpp_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_h_name = lowercase_token + '.h'
lib_objcpp_name = lowercase_token + '.mm'
test_objcpp_name = lowercase_token + '_test.mm'
@ -144,7 +145,7 @@ def create_lib_objcpp_sample(project_name, version):
'header_file': lib_h_name,
'source_file': lib_objcpp_name,
'test_source_file': test_objcpp_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -134,6 +134,7 @@ def create_lib_objc_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_h_name = lowercase_token + '.h'
lib_objc_name = lowercase_token + '.m'
test_objc_name = lowercase_token + '_test.m'
@ -144,7 +145,7 @@ def create_lib_objc_sample(project_name, version):
'header_file': lib_h_name,
'source_file': lib_objc_name,
'test_source_file': test_objc_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -82,6 +82,7 @@ def create_lib_rust_sample(project_name, version):
lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower())
uppercase_token = lowercase_token.upper()
function_name = lowercase_token[0:3] + '_func'
test_exe_name = lowercase_token + '_test'
lib_crate_name = lowercase_token
lib_rs_name = lowercase_token + '.rs'
test_rs_name = lowercase_token + '_test.rs'
@ -92,7 +93,7 @@ def create_lib_rust_sample(project_name, version):
'crate_file': lib_crate_name,
'source_file': lib_rs_name,
'test_source_file': test_rs_name,
'test_exe_name': lowercase_token,
'test_exe_name': test_exe_name,
'project_name': project_name,
'lib_name': lowercase_token,
'test_name': lowercase_token,

@ -41,7 +41,7 @@ foreach dep2 : ['sh', 'st']
main_c = configure_file(input : 'main.c.in',
output : name + '-main.c',
configuration : cdata)
dep3_bin = executable(name, main_c, link_with : dep3_lib,
dep3_bin = executable(name + '_test', main_c, link_with : dep3_lib,
c_args : build_args)
test(name + 'test', dep3_bin)
endforeach

Loading…
Cancel
Save