Skip to content

Commit

Permalink
Merge pull request #799 from hzeller/win-full-binary-build
Browse files Browse the repository at this point in the history
Expanding Windows tests running in CI
  • Loading branch information
hzeller authored Apr 28, 2021
2 parents 2a95580 + e6bb7ae commit 8bd35d9
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 50 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/windows-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,29 @@ jobs:
fetch-depth: 0
- name: Install dependencies
run: choco install llvm
- name: Build Verible
run: |
bazel build -c opt //...
# Windows support is in progress, only run "working" tests
# Remaining not working
# - verilog/tool/lint : generated linter tests. Need adaption of bzl file
# - verilog/tools/syntax/export_json_examples : python tests
- name: Run known-to-work tests
run: |
bazel test --test_output=errors `
bazel test --test_output=errors -- `
//common/... `
//external_libs/... `
//verilog/analysis/... `
//verilog/CST/... `
//verilog/analysis/... `
//verilog/formatting/... `
//verilog/parser/... `
//verilog/preprocessor/... `
//verilog/tools/diff/... `
//verilog/tools/formatter/... `
//verilog/tools/kythe/... `
//verilog/tools/lint:tool_test `
//verilog/tools/obfuscator/... `
//verilog/tools/preprocessor/... `
//verilog/tools/project/... `
//verilog/tools/syntax:verilog_syntax_test `
//verilog/transform/...
- name: Build Verible
run: |
bazel build -c opt //...
4 changes: 3 additions & 1 deletion verilog/tools/lint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ load(
"verilog_syntax",
)

load("//bazel:sh_test_with_runfiles_lib.bzl", "sh_test_with_runfiles_lib")

licenses(["notice"])

# Integration tests for different flags and configurations
Expand Down Expand Up @@ -233,7 +235,7 @@ cc_binary(
],
)

sh_test(
sh_test_with_runfiles_lib(
name = "tool_test",
size = "small",
srcs = ["lint_tool_test.sh"],
Expand Down
10 changes: 5 additions & 5 deletions verilog/tools/lint/lint_tool_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ readonly MY_OUTPUT_FILE
echo "Expecting 1 positional argument, verible-verilog-lint path."
exit 1
}
lint_tool="$1"
lint_tool="$(rlocation ${TEST_WORKSPACE}/$1)"

################################################################################
echo "=== Test no file"
Expand Down Expand Up @@ -114,7 +114,7 @@ EOF

"$lint_tool" "$TEST_FILE" --show_diagnostic_context > "${MY_OUTPUT_FILE}.out"

diff "${DIAGNOSTIC_OUTPUT}" "${MY_OUTPUT_FILE}.out"
diff --strip-trailing-cr "${DIAGNOSTIC_OUTPUT}" "${MY_OUTPUT_FILE}.out"
status="$?"
[[ $status == 0 ]] || {
echo "Expected exit code 0, but got $status"
Expand All @@ -127,7 +127,7 @@ EOF

"$lint_tool" "$TEST_FILE" > "${MY_OUTPUT_FILE}.out"

diff "${DIAGNOSTIC_OUTPUT}" "${MY_OUTPUT_FILE}.out"
diff --strip-trailing-cr "${DIAGNOSTIC_OUTPUT}" "${MY_OUTPUT_FILE}.out"
status="$?"
[[ $status == 0 ]] || {
echo "Expected exit code 0, but got $status"
Expand Down Expand Up @@ -269,8 +269,8 @@ grep -q "ERROR: Missing the value for the flag 'waiver_files'" "${MY_OUTPUT_FILE
exit 1
}

echo "=== Test --waiver_files $WAIVER_FILE with one rule"
WAIVER_FILE="${TEST_TMPDIR}/waive_module-parameter.vlt"
echo "=== Test --waiver_files $WAIVER_FILE with one rule"
cat > ${WAIVER_FILE} <<EOF
waive --rule=module-parameter
EOF
Expand All @@ -283,8 +283,8 @@ status="$?"
exit 1
}

echo "=== Test --waiver_files $WAIVER_FILE with one rule on one line"
WAIVER_FILE="${TEST_TMPDIR}/waive_module-parameter_line.vlt"
echo "=== Test --waiver_files $WAIVER_FILE with one rule on one line"
cat > ${WAIVER_FILE} <<EOF
waive --rule=module-parameter --line=1
EOF
Expand Down
4 changes: 3 additions & 1 deletion verilog/tools/obfuscator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

licenses(["notice"])

load("//bazel:sh_test_with_runfiles_lib.bzl", "sh_test_with_runfiles_lib")

cc_binary(
name = "verible-verilog-obfuscate",
srcs = ["verilog_obfuscate.cc"],
Expand All @@ -19,7 +21,7 @@ cc_binary(
],
)

sh_test(
sh_test_with_runfiles_lib(
name = "obfuscate_test",
size = "small",
srcs = ["obfuscate_test.sh"],
Expand Down
14 changes: 7 additions & 7 deletions verilog/tools/obfuscator/obfuscate_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ declare -r MY_OUTPUT_FILE2="${TEST_TMPDIR}/myoutput2.txt"
declare -r MY_SAVEMAP_FILE="${TEST_TMPDIR}/save.map"
declare -r MY_EXPECT_FILE="${TEST_TMPDIR}/myexpect.txt"

obfuscator="$1"
difftool="$2"
obfuscator="$(rlocation ${TEST_WORKSPACE}/$1)"
difftool="$(rlocation ${TEST_WORKSPACE}/$2)"

###############################################################################
echo "### Simple obfuscation test."
Expand Down Expand Up @@ -94,7 +94,7 @@ status="$?"
exit 1
}

diff -u "${MY_OUTPUT_FILE}" "${MY_EXPECT_FILE}" || exit 1
diff --strip-trailing-cr -u "${MY_OUTPUT_FILE}" "${MY_EXPECT_FILE}" || exit 1

###############################################################################
echo "### Testing reading malformed map file."
Expand Down Expand Up @@ -172,7 +172,7 @@ status="$?"
exit 1
}

diff -u "${MY_OUTPUT_FILE2}" "${MY_EXPECT_FILE}" || exit 1
diff --strip-trailing-cr -u "${MY_OUTPUT_FILE2}" "${MY_EXPECT_FILE}" || exit 1

###############################################################################
echo "Test obfuscate with --save_map to a bad path"
Expand Down Expand Up @@ -217,7 +217,7 @@ status="$?"
exit 1
}

diff -u "${MY_OUTPUT_FILE2}" "${MY_INPUT_FILE}" || exit 1
diff --strip-trailing-cr -u "${MY_OUTPUT_FILE2}" "${MY_INPUT_FILE}" || exit 1

###############################################################################
echo "Test obfuscate --preserve_interface mode"
Expand All @@ -240,14 +240,14 @@ status="$?"
intact_names=(foo_bar clk)
echo "Verify the saved map does not change interface names."
for intact_name in ${intact_names[@]}; do
grep "^${intact_name} ${intact_name}\$" ${MY_SAVEMAP_FILE} > /dev/null
grep "^${intact_name} ${intact_name}[[:space:]]*\$" "${MY_SAVEMAP_FILE}" > /dev/null
status="$?"
[[ $status == 0 ]] || {
echo "Failed to check mapping for name: ${intact_name}"
cat "${MY_SAVEMAP_FILE}"
exit 1
}
done

###############################################################################
echo "PASS"

4 changes: 3 additions & 1 deletion verilog/tools/preprocessor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

licenses(["notice"])

load("//bazel:sh_test_with_runfiles_lib.bzl", "sh_test_with_runfiles_lib")

cc_binary(
name = "verible-verilog-preprocessor",
srcs = ["verilog_preprocessor.cc"],
Expand All @@ -18,7 +20,7 @@ cc_binary(
],
)

sh_test(
sh_test_with_runfiles_lib(
name = "verilog_preprocessor_test",
size = "small",
srcs = ["verilog_preprocessor_test.sh"],
Expand Down
8 changes: 4 additions & 4 deletions verilog/tools/preprocessor/verilog_preprocessor_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ readonly MY_EXPECT_FILE
echo "Expecting 1 positional argument, verible-verilog-preprocessor path."
exit 1
}
preprocessor="$1"
preprocessor="$(rlocation ${TEST_WORKSPACE}/$1)"

################################################################################
echo "=== Test no command."
Expand Down Expand Up @@ -126,7 +126,7 @@ status="$?"
exit 1
}

diff -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
diff --strip-trailing-cr -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
exit 1
}

Expand All @@ -140,7 +140,7 @@ status="$?"
exit 1
}

diff -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
diff --strip-trailing-cr -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
exit 1
}

Expand All @@ -163,7 +163,7 @@ status="$?"
exit 0
}

diff -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
diff --strip-trailing-cr -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || {
exit 1
}

Expand Down
4 changes: 3 additions & 1 deletion verilog/tools/project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

licenses(["notice"])

load("//bazel:sh_test_with_runfiles_lib.bzl", "sh_test_with_runfiles_lib")

cc_binary(
name = "verible-verilog-project",
srcs = ["project_tool.cc"],
Expand All @@ -22,7 +24,7 @@ cc_binary(
],
)

sh_test(
sh_test_with_runfiles_lib(
name = "project_tool_test",
size = "small",
srcs = ["project_tool_test.sh"],
Expand Down
53 changes: 35 additions & 18 deletions verilog/tools/project/project_tool_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ readonly MY_EXPECT_FILE
echo "Expecting 1 positional argument, verible-verilog-project path."
exit 1
}
project_tool="$1"
project_tool="$(rlocation ${TEST_WORKSPACE}/$1)"

################################################################################
echo "=== Test no arguments."
Expand Down Expand Up @@ -95,10 +95,12 @@ status="$?"
################################################################################
echo "=== Expect failure on nonexistent file listed in the file list"

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/nonexist.txt"
echo "nonexistent.sv" > "$FILE_LIST_INPUT"
"$project_tool" \
symbol-table-refs \
--file_list_path <(echo "nonexistent.sv") \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE")" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -109,7 +111,8 @@ status="$?"
}

# Make sure we see some diagnostic message about missing files.
grep -q "No such file" "$MY_OUTPUT_FILE" || {
# System message is different in Unix vs. Windows, but they both contain 'file'
grep -q "file" "$MY_OUTPUT_FILE" || {
echo "Expected \"No such file\" in $MY_OUTPUT_FILE but didn't find it. Got:"
cat "$MY_OUTPUT_FILE"
exit 1
Expand All @@ -123,10 +126,12 @@ localparam int fooo = 1;
localparam int barr = fooo;
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt" > "$FILE_LIST_INPUT"
"$project_tool" \
symbol-table-defs \
--file_list_path <(echo myinput.txt) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE")" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -149,10 +154,12 @@ cat > "$MY_INPUT_FILE" <<EOF
localparam 777;
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt" > "$FILE_LIST_INPUT"
"$project_tool" \
symbol-table-defs \
--file_list_path <(echo myinput.txt) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE")" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -176,10 +183,12 @@ localparam int fooo = 1;
localparam int barr = fooo;
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt" > "$FILE_LIST_INPUT"
"$project_tool" \
symbol-table-refs \
--file_list_path <(echo myinput.txt) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE")" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -202,10 +211,12 @@ cat > "$MY_INPUT_FILE" <<EOF
localparam 777;
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt" > "$FILE_LIST_INPUT"
"$project_tool" \
symbol-table-refs \
--file_list_path <(echo myinput.txt) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE")" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -232,10 +243,13 @@ cat > "$MY_INPUT_FILE".B <<EOF
localparam int fooo = 1;
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt.A" > "$FILE_LIST_INPUT"
echo "myinput.txt.B" >> "$FILE_LIST_INPUT"
"$project_tool" \
file-deps \
--file_list_path <(echo myinput.txt.A ; echo myinput.txt.B ) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE".A)" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -249,7 +263,7 @@ cat > "$MY_EXPECT_FILE" <<EOF
"myinput.txt.A" depends on "myinput.txt.B" for symbols { fooo }
EOF

diff -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || { exit 1; }
diff --strip-trailing-cr -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || { exit 1; }

################################################################################
echo "=== Show dependencies between two files (modules)"
Expand All @@ -269,10 +283,13 @@ module qq;
endmodule
EOF

# Construct a file-list on-the-fly as a file-descriptor
# Construct a file-list on-the-fly as a file-descriptor
FILE_LIST_INPUT="${TEST_TMPDIR}/myinputlist.txt"
echo "myinput.txt.A" > "$FILE_LIST_INPUT"
echo "myinput.txt.B" >> "$FILE_LIST_INPUT"
"$project_tool" \
file-deps \
--file_list_path <(echo myinput.txt.A ; echo myinput.txt.B ) \
--file_list_path "$FILE_LIST_INPUT" \
--file_list_root "$(dirname "$MY_INPUT_FILE".A)" \
> "$MY_OUTPUT_FILE" 2>&1

Expand All @@ -286,7 +303,7 @@ cat > "$MY_EXPECT_FILE" <<EOF
"myinput.txt.B" depends on "myinput.txt.A" for symbols { mm }
EOF

diff -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || { exit 1; }
diff --strip-trailing-cr -u "$MY_EXPECT_FILE" "$MY_OUTPUT_FILE" || { exit 1; }

################################################################################
echo "PASS"
Loading

0 comments on commit 8bd35d9

Please sign in to comment.