forked from NationalSecurityAgency/ghidra
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (94 loc) · 4.22 KB
/
decompiler-cpp-tests.yml
File metadata and controls
108 lines (94 loc) · 4.22 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Decompiler C++ Unit Tests
# Rec 24: Build and run the C++ decompiler unit tests in CI.
# Seven unittests/*.cc files were never wired into CI. This workflow
# runs them.
#
# Also runs the 84 XML data-driven tests under datatests/ as a
# separate step. Originally these were inherited from upstream with
# ~190 stringmatch-regex drift failures (NSA doesn't run them in CI,
# so the drift went uncaught). Sprint 9's #215 audit categorized all
# 189 as cosmetic and cleared them in PRs #250–#254 + #256 with
# regex updates that match both old and new decompiler output.
# `pic_branch_ge.xml` re-enabled in Sprint 10 after porting the
# PIC24.sinc half of upstream PR #8778 — see issue #259.
#
# Coordinates with Rec 15 (ASan/UBSan CI) — that workflow runs the
# same test binary with sanitizers; this workflow runs it with the
# default debug build for fast feedback on PRs.
on:
push:
pull_request:
paths:
- 'Ghidra/Features/Decompiler/src/decompile/**'
- '.github/workflows/decompiler-cpp-tests.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
cpp_unit_tests:
name: C++ unit tests
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
# macOS dropped: TEST_DEBUG_OBJS pulls in analyzesigs/bfd_arch/
# loadimage_bfd/codedata via the EXTRA wildcard, which require
# libbfd. Apple's bundled binutils predates the bfd.h we need,
# and Homebrew's binutils is keg-only with non-trivial CPPFLAGS/
# LDFLAGS plumbing. Revisit once bfd-on-macOS is sorted.
# Windows is its own toolchain story (MSVC); land that as
# a follow-up workflow rather than overload this one.
runs-on: ${{ matrix.platform }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Install build deps (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install -y bison flex g++ make binutils-dev libiberty-dev
- name: Read Ghidra JDK version
run: echo "JDK_VER=$(awk -F'=' '$1=="application.java.min" {print $2}' Ghidra/application.properties)" >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '${{ env.JDK_VER }}'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.5'
- name: Fetch dependencies
run: gradle -I gradle/support/fetchDependencies.gradle -DhideDownloadProgress -DnoEclipse
- name: Compile SLEIGH language files (.sla)
# The C++ test binary's startDecompilerLibrary() loads real
# processor specs at startup; without precompiled .sla files
# tests fail with "Could not find .sla file for x86:LE:64:...".
# allSleighCompile aggregates every per-processor sleighCompile
# task (see gradle/processorProject.gradle).
run: gradle allSleighCompile --parallel
- name: Build decomp_test_dbg
working-directory: Ghidra/Features/Decompiler/src/decompile/cpp
run: make -j$(getconf _NPROCESSORS_ONLN) decomp_test_dbg
- name: Run unit tests
working-directory: Ghidra/Features/Decompiler/src/decompile/cpp
run: ./decomp_test_dbg unittests
- name: Run data-driven XML tests (datatests/*.xml)
working-directory: Ghidra/Features/Decompiler/src/decompile/cpp
# Sprint 9 re-enabled (#215 audit + the five regex-fix batches
# in PRs #250, #251, #252, #253, #254). The previous comment said
# "the datatests are brittle, inherited-from-upstream"; the fork's
# post-Sprint-9 stringmatch regexes now accommodate the decompiler's
# current output formatting (L-suffix on int8 literals, space-
# after-comma in calls, sign simplification, etc.). See
# docs/testing/STAGE3_ENUMERATION.md for the broader Sprint-9
# narrative.
run: ./decomp_test_dbg datatests
- name: Upload test binary on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: decomp-test-bin-${{ matrix.platform }}
path: |
Ghidra/Features/Decompiler/src/decompile/cpp/decomp_test_dbg
if-no-files-found: ignore
retention-days: 14