Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update_references.sh no longer works for subdirectory #50438

Closed
nikomatsakis opened this issue May 4, 2018 · 2 comments
Closed

update_references.sh no longer works for subdirectory #50438

nikomatsakis opened this issue May 4, 2018 · 2 comments

Comments

@nikomatsakis
Copy link
Contributor

The new update-references.sh script doesn't compute subdirectories correctly, I fear:

> ./update-references.sh ../../../build/x86_64-unknown-linux-gnu/test/ui/ single-use-lifetime/*rs
updating ./fn-types.stderr
updating ./one-use-in-fn-argument-in-band.stderr
updating ./one-use-in-fn-argument.stderr
updating ./one-use-in-inherent-impl-header.stderr
updating ./one-use-in-inherent-method-argument.stderr
updating ./one-use-in-inherent-method-return.stderr
updating ./one-use-in-trait-method-argument.stderr
updating ./two-uses-in-inherent-method-argument-and-return.stderr
updating ./zero-uses-in-fn.stderr
updating ./zero-uses-in-impl.stderr

Those files should have been placed in ./single-use-lifetime/xxx.stderr. Looking more closely at the bash script, the reason is fairly clear.

cc @ehuss

@nikomatsakis
Copy link
Contributor Author

This patch seems to work for me, though I think it may fail if you run update-references from the wrong directory .. maybe?

1 file changed, 4 insertions(+), 3 deletions(-)
src/test/ui/update-references.sh | 7 ++++---

modified   src/test/ui/update-references.sh
@@ -36,10 +36,11 @@ shopt -s nullglob
 while [[ "$1" != "" ]]; do
     for EXT in "stderr" "stdout"; do
         for OUT_NAME in $BUILD_DIR/${1%.rs}.*$EXT; do
+            OUT_DIR=`dirname "$1"`
             OUT_BASE=`basename "$OUT_NAME"`
-            if ! (diff $OUT_NAME $MYDIR/$OUT_BASE >& /dev/null); then
-                echo updating $MYDIR/$OUT_BASE
-                cp $OUT_NAME $MYDIR
+            if ! (diff $OUT_NAME $MYDIR/$OUT_DIR/$OUT_BASE >& /dev/null); then
+                echo updating $MYDIR/$OUT_DIR/$OUT_BASE
+                cp $OUT_NAME $MYDIR/$OUT_DIR
             fi
         done
     done

@ehuss
Copy link
Contributor

ehuss commented May 4, 2018

Yes, apologies! I'll try to post a fix asap.

ehuss added a commit to ehuss/rust that referenced this issue May 4, 2018
kennytm added a commit to kennytm/rust that referenced this issue May 4, 2018
…crichton

Fix update-references for tests within subdirectories.

Fixes rust-lang#50438.

I'll make this more robust later for rust-lang#49815.
ehuss added a commit to ehuss/rust that referenced this issue May 9, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 10, 2018
…crichton

Fix update-references for tests within subdirectories.

Fixes rust-lang#50438.

I'll make this more robust later for rust-lang#49815.
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 10, 2018
…crichton

Fix update-references for tests within subdirectories.

Fixes rust-lang#50438.

I'll make this more robust later for rust-lang#49815.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants