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

test: add test that build run downloads what it should #214

Merged
merged 10 commits into from
Oct 16, 2024
18 changes: 16 additions & 2 deletions .github/scripts/build_local_target.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/bin/bash

set -e
set -ex

target_name=${TARGET:-"tag_array_64x184"}
# Test local build with submacros
target_name=${TARGET:-"L1MetadataArray"}
if [[ -z "$STAGES" ]]; then
# Skip "grt" "route", takes too long
STAGES=("synth" "floorplan" "place" "cts")
else
eval "STAGES=($STAGES)"
fi


if [[ "$target_name" == "L1MetadataArray" || "$target_name" == "subpackage:L1MetadataArray" || "$target_name" == "//sram:top_mix" ]]; then
macro="true"
fi
echo "Build ${target_name} macro"
for stage in "${STAGES[@]}"
do
Expand All @@ -33,9 +38,18 @@ do
elif [[ $stage == "route" ]]; then
stages+=("do-5_2_route")
stages+=("do-5_3_fillcell")
elif [[ $stage == "cts" ]]; then
stages+=("do-cts")
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.odb' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.sdc' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.v' | wc -l) -eq 0 ]
else
stages+=("do-${stage}")
fi
if [[ "$macro" == "true" ]]; then
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lef' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lib' | wc -l) -eq 1 ]
fi
for local_stage in "${stages[@]}"
do
echo "[${target_name}] ${local_stage}: Run make script"
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,30 @@ jobs:
uses: actions/checkout@v4
- name: Run target
run: |
rm -rf ./build
set -ex

rm -rf ./build/
bazel run ${{ matrix.STAGE_TARGET }}_synth -- `pwd`/build OR_ARGS=-exit open_synth
rm -rf ./build
if [[ "${{ matrix.STAGE_TARGET }}" == "L1MetadataArray" || "${{ matrix.STAGE_TARGET }}" == "subpackage:L1MetadataArray" || "${{ matrix.STAGE_TARGET }}" == "//sram:top_mix" ]]; then
macro="true"
fi
if [[ "$macro" == "true" ]]; then
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lib' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lef' | wc -l) -eq 1 ]
fi
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/1_.*\.log' | wc -l) -gt 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/2_.*\.log' | wc -l) -eq 0 ]
rm -rf ./build/
bazel run ${{ matrix.STAGE_TARGET }}_floorplan -- `pwd`/build OR_ARGS=-exit open_floorplan

if [[ "$macro" == "true" ]]; then
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lib' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lef' | wc -l) -eq 1 ]
fi
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.odb' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.sdc' | wc -l) -eq 1 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.v' | wc -l) -eq 0 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/1_.*\.log' | wc -l) -eq 0 ]
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/2_.*\.log' | wc -l) -gt 1 ]

test-target-local-clean-setup:
name: Local flow - clean setup
Expand Down
32 changes: 11 additions & 21 deletions openroad.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ def source_inputs(ctx):
return depset(
ctx.files.src,
transitive = [
ctx.attr.src[DefaultInfo].default_runfiles.files,
ctx.attr.src[DefaultInfo].default_runfiles.symlinks,
ctx.attr.src[OrfsInfo].additional_gds,
ctx.attr.src[OrfsInfo].additional_lefs,
ctx.attr.src[OrfsInfo].additional_libs,
Expand Down Expand Up @@ -283,7 +281,7 @@ def _deps_impl(ctx):
ctx.actions.expand_template(
template = ctx.file._deploy_template,
output = exe,
substitutions = flow_substitutions(ctx) | {
substitutions = {
"${GENFILES}": " ".join(sorted([f.short_path for f in ctx.attr.src[OrfsDepInfo].files])),
"${CONFIG}": ctx.attr.src[OrfsDepInfo].config.short_path,
"${MAKE}": ctx.attr.src[OrfsDepInfo].make.short_path,
Expand Down Expand Up @@ -687,14 +685,12 @@ def _yosys_impl(ctx):
executable = exe,
files = depset(outputs),
runfiles = ctx.runfiles(
outputs + canon_logs + synth_logs + [config_short, make] +
ctx.files.verilog_files + ctx.files.extra_configs,
[config_short, make] + outputs + canon_logs + synth_logs +
ctx.files.extra_configs,
transitive_files = depset(transitive = [
flow_inputs(ctx),
yosys_inputs(ctx),
data_inputs(ctx),
pdk_inputs(ctx),
deps_inputs(ctx),
pdk_inputs(ctx),
]),
),
),
Expand Down Expand Up @@ -837,7 +833,7 @@ def _make_impl(ctx, stage, steps, forwarded_names = [], result_names = [], objec
template = ctx.file._deploy_template,
output = exe,
substitutions = {
"${GENFILES}": " ".join(sorted([f.short_path for f in [config_short] + results + logs + reports + ctx.files.data])),
"${GENFILES}": " ".join(sorted([f.short_path for f in [config_short] + results + logs + reports])),
"${CONFIG}": config_short.short_path,
"${MAKE}": make.short_path,
},
Expand All @@ -846,22 +842,16 @@ def _make_impl(ctx, stage, steps, forwarded_names = [], result_names = [], objec
return [
DefaultInfo(
executable = exe,
files = depset(
forwards + results + logs + reports,
transitive = [
ctx.attr.src[OrfsInfo].additional_gds,
ctx.attr.src[OrfsInfo].additional_lefs,
ctx.attr.src[OrfsInfo].additional_libs,
],
),
files = depset(forwards + results + reports),
runfiles = ctx.runfiles(
[config_short, make] +
forwards + results + logs + reports +
ctx.files.extra_configs,
forwards + results + logs + reports + ctx.files.extra_configs,
transitive_files = depset(transitive = [
flow_inputs(ctx),
data_inputs(ctx),
source_inputs(ctx),
ctx.attr.src[PdkInfo].files,
ctx.attr.src[OrfsInfo].additional_gds,
ctx.attr.src[OrfsInfo].additional_lefs,
ctx.attr.src[OrfsInfo].additional_libs,
]),
),
),
Expand Down