test-dir - use CARGO_TARGET_DIR
Peter Michael Green
1 year, 2 months ago
|
0 |
rust-test-dir (0.2.0-4) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
|
|
1 |
|
|
2 |
* Team upload.
|
|
3 |
* Package test_dir 0.2.0 from crates.io using debcargo 2.6.0
|
|
4 |
* Use CARGO_TARGET_DIR instead of /tmp, it's safer.
|
|
5 |
+ unfortunately we can't use CARGO_TARGET_TMPDIR because it's not available
|
|
6 |
to unit tests.
|
|
7 |
|
|
8 |
-- Peter Michael Green <plugwash@debian.org> Sat, 11 Feb 2023 07:45:27 +0000
|
|
9 |
|
0 | 10 |
rust-test-dir (0.2.0-3) unstable; urgency=medium
|
1 | 11 |
|
2 | 12 |
* Team upload.
|
0 | |
write-test-files-in-tmp.patch
|
|
0 |
write-test-files-in-cargo-target-dir.patch
|
|
0 |
Index: test-dir/src/lib.rs
|
|
1 |
===================================================================
|
|
2 |
--- test-dir.orig/src/lib.rs
|
|
3 |
+++ test-dir/src/lib.rs
|
|
4 |
@@ -313,6 +313,9 @@ mod tests {
|
|
5 |
fn test_testdir_current_rnd_dir() {
|
|
6 |
let path;
|
|
7 |
{
|
|
8 |
+ if let Some(cargo_target_dir) = option_env!("CARGO_TARGET_DIR") {
|
|
9 |
+ std::env::set_current_dir(cargo_target_dir).unwrap();
|
|
10 |
+ }
|
|
11 |
let dir = TestDir::current_rnd();
|
|
12 |
|
|
13 |
// Dir created
|
|
14 |
@@ -332,6 +335,9 @@ mod tests {
|
|
15 |
fn test_testdir_current_dir() {
|
|
16 |
let path;
|
|
17 |
{
|
|
18 |
+ if let Some(cargo_target_dir) = option_env!("CARGO_TARGET_DIR") {
|
|
19 |
+ std::env::set_current_dir(cargo_target_dir).unwrap();
|
|
20 |
+ }
|
|
21 |
let dir = TestDir::current("a/b/c");
|
|
22 |
|
|
23 |
// Dir created
|
src/test-dir/debian/patches/write-test-files-in-tmp.patch
less
more
0 | |
--- a/src/lib.rs
|
1 | |
+++ b/src/lib.rs
|
2 | |
@@ -313,6 +313,7 @@
|
3 | |
fn test_testdir_current_rnd_dir() {
|
4 | |
let path;
|
5 | |
{
|
6 | |
+ std::env::set_current_dir("/tmp").unwrap();
|
7 | |
let dir = TestDir::current_rnd();
|
8 | |
|
9 | |
// Dir created
|
10 | |
@@ -332,6 +333,7 @@
|
11 | |
fn test_testdir_current_dir() {
|
12 | |
let path;
|
13 | |
{
|
14 | |
+ std::env::set_current_dir("/tmp").unwrap();
|
15 | |
let dir = TestDir::current("a/b/c");
|
16 | |
|
17 | |
// Dir created
|