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/native/93 selfbuilt custom/tool.cpp | |
| parent | 79b2eeb1baae4097335997c191e1eb9626f27ce5 (diff) | |
| download | meson-88e13c5f7c8e977ed879cabaa2800c211a536b60.tar.gz | |
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/native/93 selfbuilt custom/tool.cpp')
| -rw-r--r-- | test cases/native/93 selfbuilt custom/tool.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test cases/native/93 selfbuilt custom/tool.cpp b/test cases/native/93 selfbuilt custom/tool.cpp new file mode 100644 index 000000000..6a28dd800 --- /dev/null +++ b/test cases/native/93 selfbuilt custom/tool.cpp @@ -0,0 +1,34 @@ +#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; +} |
