diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-01-23 15:23:13 +0000 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-09-10 07:20:41 +0000 |
commit | 88e13c5f7c8e977ed879cabaa2800c211a536b60 (patch) | |
tree | 3e168d5b347d8925cc78885de845febc2cc92fa4 /test cases/common | |
parent | 79b2eeb1baae4097335997c191e1eb9626f27ce5 (diff) | |
download | meson-88e13c5f7c8e977ed879cabaa2800c211a536b60.zip meson-88e13c5f7c8e977ed879cabaa2800c211a536b60.tar.gz meson-88e13c5f7c8e977ed879cabaa2800c211a536b60.tar.bz2 |
Split tests out from 'common' which require a native compiler
Split out tests (and parts of tests) which require a native compiler
from the 'common' suite to a new suite called 'native', so we can
selectively avoid running those tests when only a cross-compiler is
available.
Also move test '211 cmake module' to 'cmake' suite, since it appears
that the way we use cmake requires a native compiler.
Diffstat (limited to 'test cases/common')
42 files changed, 7 insertions, 622 deletions
diff --git a/test cases/common/1 trivial/meson.build b/test cases/common/1 trivial/meson.build index fb1142c..2e424d5 100644 --- a/test cases/common/1 trivial/meson.build +++ b/test cases/common/1 trivial/meson.build @@ -14,11 +14,6 @@ elif cc.get_id() == 'intel-cl' add_project_arguments('/Qdiag-error:10159', language : 'c') endif -if meson.is_cross_build() - native_exe = executable('native-trivialprog', sources : sources, native : true) - test('native exe in cross build', native_exe) -endif - exe = executable('trivialprog', sources : sources) assert(exe.name() == 'trivialprog') test('runtest', exe) # This is a comment diff --git a/test cases/common/162 external program shebang parsing/input.txt b/test cases/common/162 external program shebang parsing/input.txt deleted file mode 100644 index 40e30d4..0000000 --- a/test cases/common/162 external program shebang parsing/input.txt +++ /dev/null @@ -1 +0,0 @@ -some stuff here diff --git a/test cases/common/162 external program shebang parsing/main.c b/test cases/common/162 external program shebang parsing/main.c deleted file mode 100644 index 48b080e..0000000 --- a/test cases/common/162 external program shebang parsing/main.c +++ /dev/null @@ -1,72 +0,0 @@ -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <sys/types.h> - -#ifdef _WIN32 - #include <io.h> - #include <windows.h> -#else - #include <unistd.h> -#endif - -/* Who cares about stack sizes in test programs anyway */ -#define LINE_LENGTH 4096 - -static int -intrp_copyfile (char * src, char * dest) -{ -#ifdef _WIN32 - if (!CopyFile (src, dest, FALSE)) - return 1; - return 0; -#else - return execlp ("cp", "cp", src, dest, NULL); -#endif -} - -static void -parser_get_line (FILE * f, char line[LINE_LENGTH]) -{ - if (!fgets (line, LINE_LENGTH, f)) - fprintf (stderr, "%s\n", strerror (errno)); -} - -int -main (int argc, char * argv[]) -{ - FILE *f = NULL; - char line[LINE_LENGTH]; - - if (argc != 4) { - fprintf (stderr, "Invalid number of arguments: %i\n", argc); - goto err; - } - - if ((f = fopen (argv[1], "r")) == NULL) { - fprintf (stderr, "%s\n", strerror (errno)); - goto err; - } - - parser_get_line (f, line); - - if (!line || line[0] != '#' || line[1] != '!') { - fprintf (stderr, "Invalid script\n"); - goto err; - } - - parser_get_line (f, line); - - if (!line || strncmp (line, "copy", 4) != 0) { - fprintf (stderr, "Syntax error: %s\n", line); - goto err; - } - - return intrp_copyfile (argv[2], argv[3]); - -err: - fclose (f); - return 1; -} diff --git a/test cases/common/162 external program shebang parsing/meson.build b/test cases/common/162 external program shebang parsing/meson.build deleted file mode 100644 index c1cc5af..0000000 --- a/test cases/common/162 external program shebang parsing/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project('shebang parsing', 'c') - -interpreter = executable('aninterp', 'main.c', native : true) - -cdata = configuration_data() -cdata.set('INTRP', interpreter.full_path()) - -f = configure_file(input : 'script.int.in', - output : 'script.int', - configuration : cdata) - -# Test that parsing a shebang with spaces works properly. See `man execve`, -# specifically the section on "Interpreter scripts" and the one under "NOTES". -script = find_program(f) - -custom_target('interpthis', - input : 'input.txt', - output : 'output.txt', - depends : interpreter, - command : [script, '@INPUT@', '@OUTPUT@'], - build_by_default : true) diff --git a/test cases/common/162 external program shebang parsing/script.int.in b/test cases/common/162 external program shebang parsing/script.int.in deleted file mode 100644 index 77ff909..0000000 --- a/test cases/common/162 external program shebang parsing/script.int.in +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env @INTRP@ -copy diff --git a/test cases/common/201 override with exe/main2.input b/test cases/common/201 override with exe/main2.input deleted file mode 100644 index e69de29..0000000 --- a/test cases/common/201 override with exe/main2.input +++ /dev/null diff --git a/test cases/common/201 override with exe/meson.build b/test cases/common/201 override with exe/meson.build deleted file mode 100644 index 62d2f32..0000000 --- a/test cases/common/201 override with exe/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project('myexe', 'c') -sub = subproject('sub') - -prog = find_program('foobar', version : '>= 2.0', required : false) -assert(not prog.found()) - -prog = find_program('foobar', version : '>= 1.0') -custom1 = custom_target('custom1', - build_by_default : true, - input : [], - output : 'main1.c', - command : [prog, '@OUTPUT@']) -gen = generator(prog, - output : '@BASENAME@.c', - arguments : ['@OUTPUT@']) -custom2 = gen.process('main2.input') - -message(prog.full_path()) - -executable('e1', custom1) -executable('e2', custom2) diff --git a/test cases/common/201 override with exe/subprojects/sub/foobar.c b/test cases/common/201 override with exe/subprojects/sub/foobar.c deleted file mode 100644 index c21d450..0000000 --- a/test cases/common/201 override with exe/subprojects/sub/foobar.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <assert.h> -#include <stdio.h> - -int main(int argc, char* argv[]) { - assert(argc == 2); - FILE *f = fopen(argv[1], "w"); - const char msg[] = "int main(void) {return 0;}\n"; - size_t w = fwrite(msg, 1, sizeof(msg) - 1, f); - assert(w == sizeof(msg) - 1); - int r = fclose(f); - assert(r == 0); - return 0; -} diff --git a/test cases/common/201 override with exe/subprojects/sub/meson.build b/test cases/common/201 override with exe/subprojects/sub/meson.build deleted file mode 100644 index f0343b2..0000000 --- a/test cases/common/201 override with exe/subprojects/sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub', 'c', version : '1.0') -foobar = executable('foobar', 'foobar.c', native : true) -meson.override_find_program('foobar', foobar) diff --git a/test cases/common/21 global arg/meson.build b/test cases/common/21 global arg/meson.build index 5add17e..2a1c736 100644 --- a/test cases/common/21 global arg/meson.build +++ b/test cases/common/21 global arg/meson.build @@ -1,23 +1,16 @@ project('global arg test', 'cpp', 'c') -add_global_arguments('-DMYTHING', language : 'c', native : true) -add_global_arguments('-DMYTHING', language : 'c', native : false) -add_global_arguments('-DMYCPPTHING', language : 'cpp', native : true) -add_global_arguments('-DMYCPPTHING', language : 'cpp', native : false) - -add_global_arguments('-DGLOBAL_BUILD', language : 'c', native : true) -add_global_arguments('-DGLOBAL_HOST', language : 'c', native : false) +add_global_arguments('-DMYTHING', language : 'c') +add_global_arguments('-DMYCPPTHING', language : 'cpp') +add_global_arguments('-DGLOBAL_HOST', language : 'c') build_c_args = ['-DARG_BUILD'] c_args = ['-DARG_HOST'] -add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp'], native: true) -add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp'], native: false) +add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp']) -exe1 = executable('prog1', 'prog.c', c_args : build_c_args, native : true) -exe2 = executable('prog2', 'prog.c', c_args : c_args, native : false) +exe2 = executable('prog2', 'prog.c', c_args : c_args) exe3 = executable('prog3', 'prog.cc') -test('prog1', exe1) test('prog2', exe2) test('prog3', exe3) diff --git a/test cases/common/211 cmake module/cmake_project/CMakeLists.txt b/test cases/common/211 cmake module/cmake_project/CMakeLists.txt deleted file mode 100644 index cd91584..0000000 --- a/test cases/common/211 cmake module/cmake_project/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmakeMeson C) - -find_package(cmakeModule REQUIRED)
\ No newline at end of file diff --git a/test cases/common/211 cmake module/meson.build b/test cases/common/211 cmake module/meson.build deleted file mode 100644 index 68f9993..0000000 --- a/test cases/common/211 cmake module/meson.build +++ /dev/null @@ -1,31 +0,0 @@ -project('cmakeModule', 'c', version: '1.0.0') - -if build_machine.system() == 'cygwin' - error('MESON_SKIP_TEST CMake is broken on Cygwin.') -endif - -cmake_bin = find_program('cmake', required: false) -if not cmake_bin.found() - error('MESON_SKIP_TEST CMake not installed.') -endif - -cc = meson.get_compiler('c') -if cc.get_id() == 'clang-cl' and meson.backend() == 'ninja' and build_machine.system() == 'windows' - error('MESON_SKIP_TEST CMake installation nor operational for vs2017 clangclx64ninja') -endif - -cmake = import('cmake') - -cmake.write_basic_package_version_file(version: '0.0.1', - name: 'cmakeModule', -) - -conf = configuration_data() -conf.set('MYVAR', 'my variable value') -conf.set_quoted('MYQUOTEDVAR', 'my quoted variable value') - -cmake.configure_package_config_file( - input: 'projectConfig.cmake.in', - name: 'cmakeModule', - configuration: conf, -) diff --git a/test cases/common/211 cmake module/projectConfig.cmake.in b/test cases/common/211 cmake module/projectConfig.cmake.in deleted file mode 100644 index fa3dfca..0000000 --- a/test cases/common/211 cmake module/projectConfig.cmake.in +++ /dev/null @@ -1,4 +0,0 @@ -@PACKAGE_INIT@ - -set(MYVAR "@MYVAR@") -set(MYQUOTEDVAR @MYQUOTEDVAR@) diff --git a/test cases/common/211 cmake module/test.json b/test cases/common/211 cmake module/test.json deleted file mode 100644 index 2a5625a..0000000 --- a/test cases/common/211 cmake module/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/lib/cmake/cmakeModule/cmakeModuleConfig.cmake"}, - {"type": "file", "file": "usr/lib/cmake/cmakeModule/cmakeModuleConfigVersion.cmake"} - ] -} diff --git a/test cases/common/27 pipeline/depends/copyrunner.py b/test cases/common/27 pipeline/depends/copyrunner.py deleted file mode 100755 index 0ef6a6d..0000000 --- a/test cases/common/27 pipeline/depends/copyrunner.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import sys, subprocess - -prog, infile, outfile = sys.argv[1:] - -subprocess.check_call([prog, infile, outfile]) diff --git a/test cases/common/27 pipeline/depends/filecopier.c b/test cases/common/27 pipeline/depends/filecopier.c deleted file mode 100644 index e10e4e7..0000000 --- a/test cases/common/27 pipeline/depends/filecopier.c +++ /dev/null @@ -1,23 +0,0 @@ -#include<stdio.h> -#include<assert.h> - -#define BUFSIZE 1024 - -int main(int argc, char **argv) { - char buffer[BUFSIZE]; - size_t num_read; - size_t num_written; - FILE *fin = fopen(argv[1], "rb"); - FILE *fout; - assert(argc>0); - assert(fin); - num_read = fread(buffer, 1, BUFSIZE, fin); - assert(num_read > 0); - fclose(fin); - fout = fopen(argv[2], "wb"); - assert(fout); - num_written = fwrite(buffer, 1, num_read, fout); - assert(num_written == num_read); - fclose(fout); - return 0; -} diff --git a/test cases/common/27 pipeline/depends/libsrc.c.in b/test cases/common/27 pipeline/depends/libsrc.c.in deleted file mode 100644 index 8180551..0000000 --- a/test cases/common/27 pipeline/depends/libsrc.c.in +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 42; -} diff --git a/test cases/common/27 pipeline/depends/meson.build b/test cases/common/27 pipeline/depends/meson.build deleted file mode 100644 index 5111fee..0000000 --- a/test cases/common/27 pipeline/depends/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -runner = find_program('copyrunner.py') - -copier = executable('copier', 'filecopier.c', native: true) - -cg = generator(runner, - output: ['@BASENAME@.c'], - arguments: [copier.full_path(), '@INPUT@', '@OUTPUT@'], - depends: copier) - -test('generatordep', - executable('gd', 'prog.c', cg.process('libsrc.c.in'))) diff --git a/test cases/common/27 pipeline/depends/prog.c b/test cases/common/27 pipeline/depends/prog.c deleted file mode 100644 index 54c40e1..0000000 --- a/test cases/common/27 pipeline/depends/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func() != 42; -} diff --git a/test cases/common/27 pipeline/input_src.dat b/test cases/common/27 pipeline/input_src.dat deleted file mode 100644 index a324dca..0000000 --- a/test cases/common/27 pipeline/input_src.dat +++ /dev/null @@ -1 +0,0 @@ -int func(void) { return 0; } diff --git a/test cases/common/27 pipeline/meson.build b/test cases/common/27 pipeline/meson.build deleted file mode 100644 index e12cb7b..0000000 --- a/test cases/common/27 pipeline/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('pipeline test', 'c') - -# We need to run this executable locally so build it with -# the host compiler. -e1 = executable('srcgen', 'srcgen.c', native : true) - -# Generate a source file that needs to be included in the build. -gen = generator(e1, \ - depfile : '@BASENAME@.d', - output : '@BASENAME@.c', # Line continuation inside arguments should work without needing a "\". - arguments : ['@INPUT@', '@OUTPUT@', '@DEPFILE@']) - -generated = gen.process(['input_src.dat']) - -e2 = executable('prog', 'prog.c', generated) - -test('pipelined', e2) - -# This is in a subdirectory to make sure -# we write proper subdir paths to output. -subdir('src') - -subdir('depends') diff --git a/test cases/common/27 pipeline/prog.c b/test cases/common/27 pipeline/prog.c deleted file mode 100644 index 128f2bb..0000000 --- a/test cases/common/27 pipeline/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func(); -} diff --git a/test cases/common/27 pipeline/src/input_src.dat b/test cases/common/27 pipeline/src/input_src.dat deleted file mode 100644 index 354499a..0000000 --- a/test cases/common/27 pipeline/src/input_src.dat +++ /dev/null @@ -1 +0,0 @@ -#include<stdio.h> diff --git a/test cases/common/27 pipeline/src/meson.build b/test cases/common/27 pipeline/src/meson.build deleted file mode 100644 index 4e9ac11..0000000 --- a/test cases/common/27 pipeline/src/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -e1 = executable('srcgen', 'srcgen.c', native : true) - -# Generate a header file that needs to be included. -gen = generator(e1, - output : '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) - -generated = gen.process('input_src.dat') - -e2 = executable('prog', 'prog.c', generated) - -test('pipelined', e2) diff --git a/test cases/common/27 pipeline/src/prog.c b/test cases/common/27 pipeline/src/prog.c deleted file mode 100644 index 83121b5..0000000 --- a/test cases/common/27 pipeline/src/prog.c +++ /dev/null @@ -1,9 +0,0 @@ -#include"input_src.h" - -int main(void) { - void *foo = printf; - if(foo) { - return 0; - } - return 1; -} diff --git a/test cases/common/27 pipeline/src/srcgen.c b/test cases/common/27 pipeline/src/srcgen.c deleted file mode 100644 index 26761d2..0000000 --- a/test cases/common/27 pipeline/src/srcgen.c +++ /dev/null @@ -1,40 +0,0 @@ -#include<stdio.h> -#include<assert.h> - -#define ARRSIZE 80 - -int main(int argc, char **argv) { - char arr[ARRSIZE]; - char *ifilename; - char *ofilename; - FILE *ifile; - FILE *ofile; - size_t bytes; - - if(argc != 3) { - fprintf(stderr, "%s <input file> <output file>\n", argv[0]); - return 1; - } - ifilename = argv[1]; - ofilename = argv[2]; - printf("%s\n", ifilename); - ifile = fopen(ifilename, "r"); - if(!ifile) { - fprintf(stderr, "Could not open source file %s.\n", ifilename); - return 1; - } - ofile = fopen(ofilename, "w"); - if(!ofile) { - fprintf(stderr, "Could not open target file %s\n", ofilename); - fclose(ifile); - return 1; - } - bytes = fread(arr, 1, ARRSIZE, ifile); - assert(bytes < 80); - assert(bytes > 0); - fwrite(arr, 1, bytes, ofile); - - fclose(ifile); - fclose(ofile); - return 0; -} diff --git a/test cases/common/27 pipeline/srcgen.c b/test cases/common/27 pipeline/srcgen.c deleted file mode 100644 index ceb9ecc..0000000 --- a/test cases/common/27 pipeline/srcgen.c +++ /dev/null @@ -1,69 +0,0 @@ -#include<stdio.h> -#include<assert.h> -#include<string.h> - -#define ARRSIZE 80 - -int main(int argc, char **argv) { - char arr[ARRSIZE]; - char *ofilename; - char *ifilename; - char *dfilename; - FILE *ifile; - FILE *ofile; - FILE *depfile; - size_t bytes; - int i; - - if(argc != 4) { - fprintf(stderr, "%s <input file> <output file> <dependency file>\n", argv[0]); - return 1; - } - ifilename = argv[1]; - ofilename = argv[2]; - dfilename = argv[3]; - ifile = fopen(argv[1], "r"); - if(!ifile) { - fprintf(stderr, "Could not open source file %s.\n", argv[1]); - return 1; - } - ofile = fopen(ofilename, "w"); - if(!ofile) { - fprintf(stderr, "Could not open target file %s\n", ofilename); - fclose(ifile); - return 1; - } - bytes = fread(arr, 1, ARRSIZE, ifile); - assert(bytes < 80); - assert(bytes > 0); - fwrite(arr, 1, bytes, ofile); - - depfile = fopen(dfilename, "w"); - if(!depfile) { - fprintf(stderr, "Could not open depfile %s\n", ofilename); - fclose(ifile); - fclose(ofile); - return 1; - } - for(i=0; i<strlen(ofilename); i++) { - if(ofilename[i] == ' ') { - fwrite("\\ ", 1, 2, depfile); - } else { - fwrite(&ofilename[i], 1, 1, depfile); - } - } - fwrite(": ", 1, 2, depfile); - for(i=0; i<strlen(ifilename); i++) { - if(ifilename[i] == ' ') { - fwrite("\\ ", 1, 2, depfile); - } else { - fwrite(&ifilename[i], 1, 1, depfile); - } - } - fwrite("\n", 1, 1, depfile); - - fclose(ifile); - fclose(ofile); - fclose(depfile); - return 0; -} diff --git a/test cases/common/36 tryrun/error.c b/test cases/common/36 tryrun/error.c deleted file mode 100644 index 53ef08e..0000000 --- a/test cases/common/36 tryrun/error.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 1; -} diff --git a/test cases/common/36 tryrun/meson.build b/test cases/common/36 tryrun/meson.build deleted file mode 100644 index 5580974..0000000 --- a/test cases/common/36 tryrun/meson.build +++ /dev/null @@ -1,78 +0,0 @@ -project('tryrun', 'c', 'cpp') - -# Complex to exercise all code paths. -if meson.is_cross_build() - if meson.can_run_host_binaries() - compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)] - else - compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)] - endif -else - compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] -endif - -ok_code = '''#include<stdio.h> -int main(void) { - printf("%s\n", "stdout"); - fprintf(stderr, "%s\n", "stderr"); - return 0; -} -''' - -error_code = '''int main(void) { - return 1; -} -''' - -no_compile_code = '''int main(void) { -''' - -INPUTS = [ - ['String', ok_code, error_code, no_compile_code], - ['File', files('ok.c'), files('error.c'), files('no_compile.c')], -] - -foreach cc : compilers - foreach input : INPUTS - type = input[0] - ok = cc.run(input[1], name : type + ' should succeed') - err = cc.run(input[2], name : type + ' should fail') - noc = cc.run(input[3], name : type + ' does not compile') - - if noc.compiled() - error(type + ' compilation fail test failed.') - else - message(type + ' fail detected properly.') - endif - - if ok.compiled() - message(type + ' compilation worked.') - else - error(type + ' compilation did not work.') - endif - - if ok.returncode() == 0 - message(type + ' return code ok.') - else - error(type + ' return code fail') - endif - - if err.returncode() == 1 - message(type + ' bad return code ok.') - else - error(type + ' bad return code fail.') - endif - - if ok.stdout().strip() == 'stdout' - message(type + ' stdout ok.') - else - message(type + ' bad stdout.') - endif - - if ok.stderr().strip() == 'stderr' - message(type + ' stderr ok.') - else - message(type + ' bad stderr.') - endif - endforeach -endforeach diff --git a/test cases/common/36 tryrun/no_compile.c b/test cases/common/36 tryrun/no_compile.c deleted file mode 100644 index 496c2e8..0000000 --- a/test cases/common/36 tryrun/no_compile.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { diff --git a/test cases/common/36 tryrun/ok.c b/test cases/common/36 tryrun/ok.c deleted file mode 100644 index e2a36c8..0000000 --- a/test cases/common/36 tryrun/ok.c +++ /dev/null @@ -1,7 +0,0 @@ -#include<stdio.h> - -int main(void) { - printf("%s\n", "stdout"); - fprintf(stderr, "%s\n", "stderr"); - return 0; -} diff --git a/test cases/common/56 install script/meson.build b/test cases/common/56 install script/meson.build index e80e666..696e3f6 100644 --- a/test cases/common/56 install script/meson.build +++ b/test cases/common/56 install script/meson.build @@ -25,9 +25,3 @@ t = custom_target( meson.add_install_script('myinstall.py', 'customtarget', t, '--mode=copy') meson.add_install_script('myinstall.py', 'customtargetindex', t[0], '--mode=copy') - -meson.add_install_script(exe, 'generated.txt') -wrap = find_program('wrap.py') -# Yes, these are getting silly -meson.add_install_script(wrap, exe, 'wrapped.txt') -meson.add_install_script(wrap, wrap, exe, 'wrapped2.txt') diff --git a/test cases/common/56 install script/src/exe.c b/test cases/common/56 install script/src/exe.c deleted file mode 100644 index b573b91..0000000 --- a/test cases/common/56 install script/src/exe.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -int main(int argc, char * argv[]) { - if (argc != 2) { - fprintf(stderr, "Takes exactly 2 arguments\n"); - return 1; - } - - char * dirname = getenv("MESON_INSTALL_DESTDIR_PREFIX"); - char * fullname = malloc(strlen(dirname) + 1 + strlen(argv[1]) + 1); - strcpy(fullname, dirname); - strcat(fullname, "/"); - strcat(fullname, argv[1]); - - FILE * fp = fopen(fullname, "w"); - fputs("Some text\n", fp); - fclose(fp); - - free(fullname); - - return 0; -} diff --git a/test cases/common/56 install script/src/meson.build b/test cases/common/56 install script/src/meson.build index 1db424f..123fe18 100644 --- a/test cases/common/56 install script/src/meson.build +++ b/test cases/common/56 install script/src/meson.build @@ -1,5 +1,3 @@ meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') afile = files('a file.txt') - -exe = executable('exe', 'exe.c', install : false, native : true) diff --git a/test cases/common/56 install script/test.json b/test cases/common/56 install script/test.json index b2a5971..3804fe1 100644 --- a/test cases/common/56 install script/test.json +++ b/test cases/common/56 install script/test.json @@ -9,9 +9,6 @@ {"type": "file", "file": "usr/dir/conf.txt"}, {"type": "file", "file": "usr/customtarget/1.txt"}, {"type": "file", "file": "usr/customtarget/2.txt"}, - {"type": "file", "file": "usr/customtargetindex/1.txt"}, - {"type": "file", "file": "usr/generated.txt"}, - {"type": "file", "file": "usr/wrapped.txt"}, - {"type": "file", "file": "usr/wrapped2.txt"} + {"type": "file", "file": "usr/customtargetindex/1.txt"} ] } diff --git a/test cases/common/56 install script/wrap.py b/test cases/common/56 install script/wrap.py deleted file mode 100755 index 87508e0..0000000 --- a/test cases/common/56 install script/wrap.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import subprocess -import sys - -subprocess.run(sys.argv[1:]) diff --git a/test cases/common/85 add language/meson.build b/test cases/common/85 add language/meson.build index aa4972a..e99f33a 100644 --- a/test cases/common/85 add language/meson.build +++ b/test cases/common/85 add language/meson.build @@ -2,10 +2,9 @@ project('add language', 'c') test('C', executable('cprog', 'prog.c')) -assert(add_languages('cpp'), 'Add_languages returned false on success') +assert(add_languages('cpp', native: false), 'Add_languages returned false on success') assert(not add_languages('klingon', required : false), 'Add_languages returned true on failure.') test('C++', executable('cppprog', 'prog.cc')) -add_languages('c', native: true) add_languages('c', native: false) diff --git a/test cases/common/93 selfbuilt custom/checkarg.cpp b/test cases/common/93 selfbuilt custom/checkarg.cpp deleted file mode 100644 index 99092ee..0000000 --- a/test cases/common/93 selfbuilt custom/checkarg.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include <cassert> - -int main(int argc, char *[]) { - assert(argc == 2); - return 0; -} diff --git a/test cases/common/93 selfbuilt custom/data.dat b/test cases/common/93 selfbuilt custom/data.dat deleted file mode 100644 index 83fd1d9..0000000 --- a/test cases/common/93 selfbuilt custom/data.dat +++ /dev/null @@ -1 +0,0 @@ -generated_function diff --git a/test cases/common/93 selfbuilt custom/mainprog.cpp b/test cases/common/93 selfbuilt custom/mainprog.cpp deleted file mode 100644 index bb45dca..0000000 --- a/test cases/common/93 selfbuilt custom/mainprog.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include"data.h" - -int main(void) { - return generated_function() != 52; -} diff --git a/test cases/common/93 selfbuilt custom/meson.build b/test cases/common/93 selfbuilt custom/meson.build deleted file mode 100644 index b536352..0000000 --- a/test cases/common/93 selfbuilt custom/meson.build +++ /dev/null @@ -1,39 +0,0 @@ -project('selfbuilt custom', 'cpp') - -# Build an exe and use it in a custom target -# whose output is used to build a different exe. - -tool = executable('tool', 'tool.cpp', native : true) - -hfile = custom_target('datah', - output : 'data.h', - input : 'data.dat', - command : [tool, '@INPUT@', '@OUTPUT@'], -) - -main = executable('mainprog', 'mainprog.cpp', hfile) - -test('maintest', main) - -lib = library('libtool', 'tool.cpp') - -checkarg = executable('checkarg', 'checkarg.cpp', native : true) - -ctlib = custom_target('ctlib', - output : 'ctlib.out', - capture : true, - command : [checkarg, lib], - build_by_default : true, -) - -if meson.is_cross_build() and meson.can_run_host_binaries() - checkarg_host = executable('checkarg_host', 'checkarg.cpp') - - ctlib_host = custom_target( - 'ctlib_host', - output : 'ctlib.host.out', - capture : true, - command : [checkarg_host, lib], - build_by_default : true, - ) -endif diff --git a/test cases/common/93 selfbuilt custom/tool.cpp b/test cases/common/93 selfbuilt custom/tool.cpp deleted file mode 100644 index 6a28dd8..0000000 --- a/test cases/common/93 selfbuilt custom/tool.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include<iostream> -#include<fstream> -#include<string> - -using namespace std; - -const char prefix[] = "int "; -const char suffix[] = " () {\n return 52;}\n"; - -int main(int argc, char **argv) { - if(argc != 3) { - cout << "You is fail.\n"; - return 1; - } - ifstream is(argv[1], ifstream::binary); - if(!is) { - cout << "Opening input file failed.\n"; - return 1; - } - string funcname; - is >> funcname; - ofstream os(argv[2], ofstream::binary); - if(!os) { - cout << "Opening output file failed.\n"; - return 1; - } - os << prefix << funcname << suffix; - os.close(); - if(!os.good()) { - cout << "Writing data out failed.\n"; - return 1; - } - return 0; -} |