-
Notifications
You must be signed in to change notification settings - Fork 123
Linker Improvements #2
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
Changes from all commits
fbde6d0
617b62a
fcd7d96
132aacd
3c855ad
b970b4a
733e9a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
|
||
. ../../dttools/src/test_runner.common.sh | ||
|
||
out_dir="linker_collision_out" | ||
|
||
prepare() { | ||
if [ -d "$out_dir" ]; then | ||
exit 1 | ||
fi | ||
|
||
echo "t" > /tmp/asdf | ||
echo "a" > linker/asdf | ||
|
||
cd ../src/; make | ||
exit $? | ||
} | ||
|
||
run() { | ||
cd linker | ||
../../src/makeflow -b "$out_dir" collision.mf | ||
|
||
files=`ls "$out_dir" | wc -l` | ||
if [ $files != "3" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that there are only three files, please check that each of them was generated with the correct name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about checking each file, but that would become a very brittle test. If the translate function changes in any way the file names will change, but there will always be three. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What worries me is that we do care about the names, since they have to match the names in the makeflow file. What if we copy with a name but write another to the makeflow file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess what we should be checking is that the names in the makeflow file correspond to the files in the bundle directory. I will work on this tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking that the names in the makeflow file correspond to the copied files is unnecessary. Both are renamed with the same function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same function, yes, but a function with internal state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function does not have an internal state. It is external, otherwise it wouldn't be shared between calls. The state also ensures that every reference to a file is mapped identically. Testing this function with our current framework would require re-parsing both the old and new makeflow files, computing the differences, and comparing the differences with the file system. This is a prime candidate for unit testing. |
||
exit 1 | ||
fi | ||
|
||
exit 0 | ||
} | ||
|
||
clean() { | ||
cd linker | ||
rm -r "$out_dir" | ||
rm /tmp/asdf | ||
rm asdf | ||
exit 0 | ||
} | ||
|
||
dispatch $@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/sh | ||
|
||
. ../../dttools/src/test_runner.common.sh | ||
|
||
out_dir="linker_complex_out" | ||
|
||
prepare() { | ||
if [ -d "$out_dir" ]; then | ||
exit 1 | ||
fi | ||
|
||
touch /tmp/makeflow_test_complex_path | ||
mkdir -p /tmp/a/b/x | ||
touch /tmp/a/b/x/y | ||
chmod 777 /tmp/a/b/x/y | ||
cd ../src/; make | ||
exit $? | ||
} | ||
|
||
run() { | ||
cd linker | ||
../../src/makeflow -b "$out_dir" complex.mf | ||
|
||
if [ ! -f "$out_dir"/makeflow_test_complex_path ]; then | ||
exit 1 | ||
fi | ||
|
||
filename="$out_dir"/y | ||
if [ ! -f $filename ]; then | ||
exit 1 | ||
fi | ||
|
||
case `uname -s` in | ||
Darwin) | ||
cmd=`stat $filename | awk '{print $3}'` | ||
;; | ||
*) | ||
cmd=`stat -c %A $filename` | ||
;; | ||
esac | ||
|
||
if [ ! "-rwxrwxrwx" == "$cmd" ]; then | ||
exit 1 | ||
fi | ||
|
||
first_line=`head -n 1 $out_dir/complex.mf` | ||
if [ ! $? == 0 ]; then | ||
exit 1 | ||
fi | ||
if [ ! "VARIABLE=\"testing\"" == "$first_line" ]; then | ||
exit 1 | ||
fi | ||
|
||
exit 0 | ||
} | ||
|
||
clean() { | ||
cd linker | ||
rm -r "$out_dir" | ||
rm -r /tmp/a | ||
rm -r /tmp/makeflow_test_complex_path | ||
exit 0 | ||
} | ||
|
||
dispatch $@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
: asdf /tmp/asdf | ||
echo "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
VARIABLE = "testing" | ||
|
||
: out.put | ||
echo "" | ||
|
||
out.put : /tmp/makeflow_test_complex_path /tmp/a/b/x/y | ||
touch out.put |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing one const in the function cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a second const results in a warning.
makeflow.c:359: warning: passing argument 2 of ‘cctools_list_find’ from incompatible pointer type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check list.h, and list.c...