forked from tensorflow/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-all
executable file
·86 lines (78 loc) · 4.09 KB
/
test-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
set -e
function run {
echo "----------------------------------------------------------------------"
echo "Running $@"
"$@"
echo
}
# Make sure the Tensorflow version in the -sys build script matches the one in
# the run-valgrind script.
version_build_script=`grep "const VERSION" tensorflow-sys/build.rs | sed 's|.*"\([^"]*\)";|\1|g'`
version_run_valgrind=`grep "tensorflow_version=" run-valgrind | sed "s|.*=\(.*\)|\1|g"`
version_requirements=`grep "tensorflow\s*=" .github/workflows/requirements.txt | sed "s|.*== \(.*\)|\1|g"`
if [[ "${version_build_script}" != "${version_run_valgrind}" || \
"${version_build_script}" != "${version_requirements}" ]]; then
echo "ERROR: Tensorflow version specified in build script does not match the one in the"
echo " valgrind run script."
echo " tensorflow-sys/build.rs: ${version_build_script}"
echo " run-valgrind: ${version_run_valgrind}"
echo " ./github/workflows/requirements.txt: ${version_requirements}"
exit 1
fi
# Make sure the crate version matches the one in README.md.
version_tensorflow_crate=`grep "^version =" Cargo.toml | sed 's|.*= "\(.*\)"|\1|g'`
version_tensorflow_readme=`sed -En 's|tensorflow *= *"([^"]*)"|\1|p' < README.md`
version_tensorflow_readme2=`sed -En 's|tensorflow *= *\{ *version *= *"([^"]*)".*$|\1|p' < README.md`
if [[ "${version_tensorflow_crate}" != "${version_tensorflow_readme}" || \
"${version_tensorflow_crate}" != "${version_tensorflow_readme2}" ]]; then
echo "ERROR: tensorflow crate version does not match the ones in README.md."
echo " Cargo.toml: ${version_tensorflow_crate}"
echo " README.md: ${version_tensorflow_readme}"
echo " README.md: ${version_tensorflow_readme2}"
exit 1
fi
# Make sure the crate version matches the one in README.md for tensorflow-sys.
version_tensorflow_sys_crate=`grep "^version =" tensorflow-sys/Cargo.toml | sed 's|.*= "\(.*\)"|\1|g'`
version_tensorflow_sys_readme=`sed -En 's|tensorflow-sys *= *\{ *version *= *"([^"]*)".*$|\1|p' < tensorflow-sys/README.md`
if [[ "${version_tensorflow_sys_crate}" != "${version_tensorflow_sys_readme}" ]]; then
echo "ERROR: tensorflow-sys crate version does not match the one in README.md."
echo " Cargo.toml: ${version_tensorflow_sys_crate}"
echo " README.md: ${version_tensorflow_sys_readme}"
exit 1
fi
run python3 examples/mobilenetv3/create_model.py
run cargo fmt --all -- --check
run cargo test -vv -j 2
run cargo test -vv -j 2 --features eager
run cargo test -vv -j 2 --features tensorflow_unstable
run cargo test -vv -j 2 --features ndarray
run cargo run --example regression
run cargo run --example xor
run cargo run --features tensorflow_unstable --example expressions
run cargo run --features eager --example mobilenetv3
run cargo doc -vv --features tensorflow_unstable,ndarray,eager
run cargo doc -vv --features tensorflow_unstable,ndarray,eager,private-docs-rs
# TODO(#66): Re-enable: (cd tensorflow-sys && cargo test -vv -j 1)
(cd tensorflow-sys && run cargo run --example multiplication)
(cd tensorflow-sys && run cargo run --example tf_version)
(cd tensorflow-sys && run cargo doc -vv)
run cargo clippy
(cd tensorflow-sys && run cargo clippy)
(cd tensorflow-op-codegen && run cargo clippy)
(cd tensorflow-proto-codegen && run cargo clippy)
(cd tensorflow-internal-macros && run cargo clippy)
for file in $(find . -name target -prune -o -name '*.rs' -print); do
bad_deprecations="$(rustfmt --emit stdout --config max_width=1000 "$file" | grep '#\[deprecated' | grep -E -v '([^"\\]|\\.|"([^"\\]|\\.)*")*since' || true)"
if [[ "${bad_deprecations}" != "" ]]; then
echo "ERROR: #[deprecated] attribute(s) found with no 'since' key in $file:"
echo "${bad_deprecations}"
exit 1
fi
bad_deprecations="$(rustfmt --emit stdout --config max_width=1000 "$file" | grep '#\[deprecated' | grep -E -v '([^"\\]|\\.|"([^"\\]|\\.)*")*note' || true)"
if [[ "${bad_deprecations}" != "" ]]; then
echo "ERROR: #[deprecated] attribute(s) found with no 'note' key in $file:"
echo "${bad_deprecations}"
exit 1
fi
done