-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #616: Infinite new-process recursion using dub decribe within pre…
…GenerateCommands
- Loading branch information
Showing
14 changed files
with
155 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
set -e -o pipefail | ||
|
||
cd "$CURR_DIR"/issue616-describe-vs-generate-commands | ||
|
||
temp_file=`mktemp` | ||
temp_file2=`mktemp` | ||
|
||
function cleanup { | ||
rm $temp_file | ||
rm $temp_file2 | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
if ! $DUB describe --data-list --data=target-name \ | ||
> "$temp_file" 2>&1; then | ||
die 'Printing project data failed!' | ||
fi | ||
|
||
# Create the expected output file to compare stdout against. | ||
expected_file="$CURR_DIR/expected-issue616-output" | ||
echo "preGenerateCommands: DUB_PACKAGES_USED=issue616-describe-vs-generate-commands,issue616-subpack,issue616-subsubpack" > "$expected_file" | ||
echo "$CURR_DIR/issue616-describe-vs-generate-commands/src/" >> "$expected_file" | ||
echo "$CURR_DIR/issue616-subpack/src/" >> "$expected_file" | ||
echo "$CURR_DIR/issue616-subsubpack/src/" >> "$expected_file" | ||
echo "issue616-describe-vs-generate-commands" >> "$expected_file" | ||
|
||
# Create the expected output file to compare stderr against. | ||
expected_file2="$CURR_DIR/expected-issue616-output2" | ||
echo "preGenerateCommands: DUB_PACKAGES_USED=issue616-describe-vs-generate-commands,issue616-subpack,issue616-subsubpack" > "$expected_file2" | ||
echo "$CURR_DIR/issue616-describe-vs-generate-commands/src/" >> "$expected_file2" | ||
echo "$CURR_DIR/issue616-subpack/src/" >> "$expected_file2" | ||
echo "$CURR_DIR/issue616-subsubpack/src/" >> "$expected_file2" | ||
|
||
if ! diff "$expected_file" "$temp_file"; then | ||
die 'The stdout output did not match the expected output!' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
10 changes: 10 additions & 0 deletions
10
test/issue616-describe-vs-generate-commands/do-preGenerateCommands.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
if [ -n "${dub_issue616}" ]; then | ||
echo 'Fail! preGenerateCommands recursion detected!' >&2 | ||
exit 0 # Don't return a non-zero error code here. This way the test gives a better diagnostic. | ||
fi | ||
|
||
echo preGenerateCommands: DUB_PACKAGES_USED=$DUB_PACKAGES_USED >&2 | ||
|
||
export dub_issue616=true | ||
$DUB describe --data-list --data=import-paths >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "issue616-describe-vs-generate-commands", | ||
"targetType": "executable", | ||
"preGenerateCommands-posix": ["cd $PACKAGE_DIR && ./do-preGenerateCommands.sh"], | ||
"dependencies": { | ||
"issue616-subpack": { | ||
"version": "1.0", | ||
"path": "../issue616-subpack" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "issue616-subpack", | ||
"targetType": "executable", | ||
"dependencies": { | ||
"issue616-subsubpack": { | ||
"version": "1.0", | ||
"path": "../issue616-subsubpack" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "issue616-subsubpack", | ||
"targetType": "executable" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|