aboutsummaryrefslogtreecommitdiff
path: root/test cases/rust
AgeCommit message (Collapse)AuthorFilesLines
2021-06-22tests: both_library test improvementsDaniel Mensinger1-1/+1
This switches some `shared_library()` calls to `library()` and adds one new CI matrix entries for -Ddefault_library={static, both}.
2021-05-18Add a rust test for internal c linkageDylan Baker5-0/+76
We have code to support this, but no tests. That seems pretty bad. And better yet, it doesn't work on MSVC in some cases.
2021-03-10Add test to build a mixed C/Rust shared library.Jussi Pakkanen5-0/+93
2021-02-26tests/rust: Add rust case linking to libm in rust static libraryJordan Justen5-0/+53
When building on Linux, I see: rustc -C linker=cc --color=always --crate-type rlib --crate-name rs_math -g --emit dep-info=rs_math.d --emit link -L /usr/lib/x86_64-linux-gnu -o librs_math.rlib -l static=m ../rs_math.rs error: failed to add native library /usr/lib/x86_64-linux-gnu/libm.a: file too small to be an archive I think the "file too small to be an archive" message is coming from libLLVM, and is a case of LLVM not handling this type of "script archive". So, possibly this is just LLVM not handling a linking case. The rust_args usage in meson.build is invalid, but required to reproduce the issue in the test case. Perhaps meson should automatically add the library include path via the dep_m meson object, or maybe the meson.build can add the link path in a better way. Changing '-l static=m' to '-l dylib=m' appears to fix this case. (See comments in meson.build.)
2021-02-23rust: fix linking with external dependenciesDylan Baker1-1/+4
Rust can link with any dependency that uses c linkage, which is pretty much what we assume across the board anyway.
2021-02-23tests/rust: Add rust case linking to zlib dependencyJordan Justen5-0/+59
Reworks: * Add MESON_SKIP_TEST error for darwin from polyglot test * Remove dependencies from executable Dylan's changes: * Add support for both static and shared testing * Test with pkg-config, cmake, and system * reformat to meson's style Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2021-02-06rust: Add a module wrapper for bindgenDylan Baker8-0/+191
This has a couple of advantages over rolling it by hand: 1. it correctly handles include_directories objects, which is always handy 2. it correctly generates a depfile for you, which makes it more reliable 3. it requires less typing
2021-01-21tests/rust: Add a generated library to generated main testDylan Baker4-1/+19
Which is broken, of course.
2021-01-21tests/rust: Add subdir to generated sources testDylan Baker2-2/+11
2021-01-19rust: Accept generated sources for main.rsDylan Baker2-0/+32
There are still caveats here. Rust/cargo handles generated sources by writing out all targets of a single repo into a single output directory, setting a path to that via a build-time environment variable, and then include those files via a set of functions and macros. Meson's build layout is naturally different, and ninja makes working with environment variables at compile time difficult. Fixes #8157
2021-01-05modules: Add an unstable-rust moduleDylan Baker2-0/+22
Like other language specific modules this module is module for holding rust specific helpers. This commit adds a test() function, which simplifies using rust's internal unittest mechanism. Rust tests are generally placed in the same code files as they are testing, in contrast to languages like C/C++ and python which generally place the tests in separate translation units. For meson this is somewhat problematic from a repetition point of view, as the only changes are generally adding --test, and possibly some dependencies. The rustmod.test() method provides a mechanism to remove the repatition: it takes a rust target, copies it, and then addes the `--test` option, then creates a Test() target with the `rust` protocol. You can pass additional dependencies via the `dependencies` keyword. This all makes for a nice, DRY, test definition.
2021-01-05mtest: Add support for rust unit testsDylan Baker2-0/+56
Rust has it's own built in unit test format, which is invoked by compiling a rust executable with the `--test` flag to rustc. The tests are then run by simply invoking that binary. They output a custom test format, which this patch adds parsing support for. This means that we can report each subtest in the junit we generate correctly, which should be helpful for orchestration systems like gitlab and jenkins which can parse junit XML.
2020-11-11tests/rust: dynamic linking doesn't work on darwinDylan Baker2-0/+8
This is a bug, and needs to be fixed, but in the short term testing other rust functionality on darwin is an improvement over testing none.
2020-11-05rust: implement support for --editionDylan Baker3-0/+30
Using the std option, so now `rust_std=..` will work. I've chosen to use "std" even though rust calls these "editions", as meson refers to language versions as "standards", which makes meson feel more uniform, and be less surprising. Fixes: #5100
2020-02-25test: merge installed_files.txt into test.jsonDaniel Mensinger14-29/+56
2019-11-18Use strict function prototypesMichael Hirsch, Ph.D2-2/+2
2019-06-22Fix the last remaining Rust install file list.Jussi Pakkanen1-1/+5
2019-06-22Run Rust shared library test via rustup to get the environment right.Jussi Pakkanen1-1/+8
2019-06-21Add Rust generated pdbs to list of installed files.Jussi Pakkanen6-1/+12
2019-03-24Fix setup so test suite runs with rustc + MSVC. Closes: 5099Jussi Pakkanen1-2/+8
2018-06-17Support Rust targets with more than one source file. Closes #3632.Jussi Pakkanen3-0/+11
2018-02-22Fix Rust compiler-private library ambiguityAdam C. Foltzer4-0/+14
When building a Rust target with Rust library dependencies, an `--extern` argument is now specified to avoid ambiguity between the dependency library, and any crates of the same name in `rustc`'s private sysroot. Includes an illustrative test case.
2018-02-02Fix Rust shared polyglot test case for cross-compilationAdam C. Foltzer1-1/+1
The crate-type in this case should have been `cdylib` since it's linking via C, rather than the default `dylib` that is meant for linking via `rustc`.
2017-07-22add `crate-name` to Rust target argsAdam C. Foltzer4-0/+11
This is required for downstream Rust dependencies to properly import libraries using `extern crate`.
2017-06-14fix failing Rust test casesAdam C. Foltzer1-1/+1
2017-06-14rename `crate_type` to `rust_crate_type` per @TingPingAdam C. Foltzer1-1/+1
2017-06-09Enhance Rust supportAdam C. Foltzer8-0/+47
- Adds a `crate_type` kwarg to library targets, allowing the different types of Rust [linkage][1]. - Shared libraries use the `dylib` crate type by default, but can also be `cdylib` - Static libraries use the `rlib` crate type by default, but can also be `staticlib` - If any Rust target has shared library dependencies, add the appropriate linker arguments, including rpath for the sysroot of the Rust compiler [1]: https://doc.rust-lang.org/reference/linkage.html
2017-05-08rust: Support rust_argsPatrick Griffis1-1/+4
2017-03-29rust: Support executable name differing from source namePatrick Griffis4-2/+10
2016-07-01Fix tests for the new library/executable naming schemeNirbheek Chauhan3-3/+3
Also add new tests for the platform-specific and compiler-specific versioning scheme. A rough summary is: 1. A bug in how run_tests.py:validate_install checked for files has been fixed. Earlier it wasn't checking the install directory properly. 2. Shared libraries are no longer installed in common tests, and the library name/path testing is now done in platform-specific tests. 3. Executables are now always called something?exe in the installed_files.txt file, and the suffix automatically corrected depending on the platform. 4. If a test installs a file called 'no-installed-files', the installed files for that test are not validated. This is required to implement compiler-specific tests for library names/paths such as MSVC vs MinGW 5. The platform-specific file renaming in run_tests.py has been mostly removed since it is broken for shared libraries and isn't needed for static libraries. 6. run_tests.py now reports all missing and extra files. The logic for finding these has been reworked.
2015-10-11Fix Rust to work with 1.3 release. Closes #277.Jussi Pakkanen5-7/+7
2014-06-23Deal with Rust static libraries, too.Jussi Pakkanen4-0/+13
2014-06-23Install Rust shared libraries.Jussi Pakkanen2-2/+4
2014-06-22Invoke Rust via wrapper script.Jussi Pakkanen2-2/+2
2014-06-19Set up dependencies for Rust linking. Does not work fully yet.Jussi Pakkanen2-0/+5
2014-06-19Build a shared Rust library.Jussi Pakkanen2-0/+6
2014-06-18Can compile very basic Rust programs.Jussi Pakkanen3-0/+8