Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
    • RTL and Testbench Assistance
    • Debugging with AI
    • Scripts and Automation
      • Reviewing Generated Scripts
      • Idempotence and Dry-Run Flags
      • Testing a Script on a Copy
      • A Small Static Checker for Scripts
    • Data, Privacy and IP
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Scripts and Automation
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Using AI for Engineering Work
  4. Scripts and Automation
  5. Testing a Script on a Copy

Everyday Engineering Assistance · Beginner to Intermediate

Testing a Script on a Copy

Trying a new script on a copy or small fixture before touching real files.

On this page

    A copy before the real run

    Copy the target tree, or build a small fixture with the same shapes. Run the new script against the copy and inspect what changed.

    Trial on

    Size

    Restore after a mistake

    Disposable copy

    Small fixture or full copy

    Delete and rebuild the copy.

    Live data

    Full working tree

    Restore from backups, slowly.

    Long inputs are used less reliably than short ones, and material in the middle of a long input gets less use than material at the ends.

    This tendency varies by model, so keep trial outputs short and measure it.

    Small fixtures

    A fixture needs one of each shape the script treats differently. Keep-alive files, deletable files and nested directories each earn one entry.

    Keep fixtures beside the script under version control. A fixture that drifts from reality stops proving anything.

    Comparing results

    The program below models a log-cleanup trial over six fixed names. The live tuple is never mutated; only new lists are built.

    example.py
    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
    import sys
    
    LIVE = ("a.sdc", "b.sdc", "top.v", "notes.txt", "run.log", "gold.ref")
    
    def cleanup(files, do_delete):
        kept = []
        dropped = []
        for name in files:
            if name.endswith(".log"):
                if do_delete:
                    dropped.append(name)
                else:
                    kept.append(name)
            else:
                kept.append(name)
        return kept, dropped
    
    def main():
        bad = 0
        copy = list(LIVE)
        kept, dropped = cleanup(copy, True)
        if dropped != ["run.log"]:
            bad += 1
        if len(kept) != 5:
            bad += 1
        if len(list(LIVE)) != 6:
            bad += 1
        if "run.log" not in LIVE:
            bad += 1
        if bad:
            print("FAIL: copy trial counts wrong")
            sys.exit(1)
        print("PASS: copy run drops 1 file, live tree keeps 6 files")
    
    main()
    plaintext
    assume copying the fixture takes 4 s and one trial run takes 6 s (stated example parameters)
    one trial costs 4 + 6 = 10 s
    three trials cost 3 x 10 = 30 s

    Common mistakes

    Common pitfall

    Testing on a fixture, then running different flags on live data. Any flag that differs voids the trial, so freeze the exact command first.

    Interview

    Likely probes: what the fixture must contain and what voids a trial.

    • One of each shape the script treats differently.

    • Fixtures live beside the script under version control.

    • Changed flags or paths between trial and run void the trial.

    Check yourself A trial drops run.log from a six-file copy. How many files does the copy keep, and what changed in the live tree?

    The copy keeps five files. The live tree is unchanged at six files.

    Check yourself Copying takes 4 s and one trial takes 6 s. What do three identical trials cost?

    30 s. Each trial costs 10 s, and three times 10 s is 30 s.

    Related topics

    • A small static checker for scripts

    • Self-checking regression

    Previous

    59 / 173

    Next: A Small Static Checker for Scripts

    Up next

    Up nextA Small Static Checker for Scripts

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Reviewing Generated Scripts