Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit 48e23f7

Browse files
authored
Merge b7ab4a6 into a07b0aa
2 parents a07b0aa + b7ab4a6 commit 48e23f7

File tree

8 files changed

+86
-1
lines changed

8 files changed

+86
-1
lines changed

.github/workflows/test-pr.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,24 @@ jobs:
5858
profile:
5959
needs: code-quality-checks
6060
name: 'Profiling'
61-
runs-on: ubuntu-latest
61+
runs-on: [self-hosted, linux, normal-ephemeral]
6262
steps:
6363
- name: 'Check out code'
6464
uses: actions/checkout@v3
65+
- name: 'Install Python'
66+
uses: actions/setup-python@v4
67+
with:
68+
python-version: '3.10'
6569
- name: 'Install Poetry'
6670
uses: Gr1N/setup-poetry@v8
71+
- name: 'Install K'
72+
run: |
73+
K_VERSION=$(cat deps/k_release)
74+
DEB_PACKAGE_NAME=kframework_${K_VERSION}_amd64_ubuntu_jammy.deb
75+
wget https://github.com/runtimeverification/k/releases/download/v${K_VERSION}/${DEB_PACKAGE_NAME}
76+
sudo apt-get update
77+
sudo apt-get -y install ./${DEB_PACKAGE_NAME}
78+
kompile --version
6779
- name: 'Run profiling'
6880
run: |
6981
make profile

src/tests/profiling/profile_kbuild.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
5+
import pytest
6+
7+
from pyk.kbuild import KBuild, Package
8+
9+
from .utils import TEST_DATA_DIR
10+
11+
if TYPE_CHECKING:
12+
from pathlib import Path
13+
from typing import Final
14+
15+
from pyk.testing import Profiler
16+
17+
18+
A_SEMANTICS_DIR: Final = TEST_DATA_DIR / 'kbuild/a-semantics'
19+
20+
21+
@pytest.fixture
22+
def kbuild(tmp_path: Path) -> KBuild:
23+
return KBuild(tmp_path / 'kbuild')
24+
25+
26+
def test_kbuild(kbuild: KBuild, profile: Profiler) -> None:
27+
with profile('kompile.txt', sort_keys=('cumtime', 'tottime'), limit=35):
28+
package = Package.create(A_SEMANTICS_DIR / 'kbuild.toml')
29+
kbuild.kompile(package, 'llvm')
30+
31+
with profile('rekompile.txt', sort_keys=('cumtime', 'tottime'), limit=35):
32+
package = Package.create(A_SEMANTICS_DIR / 'kbuild.toml')
33+
kbuild.kompile(package, 'llvm')
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
requires "b-semantics/b.k"
2+
requires "c-semantics/c.k"
3+
4+
module A-SYNTAX
5+
endmodule
6+
7+
module A
8+
imports B
9+
imports C
10+
endmodule
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
name = "a-semantics"
3+
version = "0.1.0"
4+
source = "."
5+
6+
[dependencies]
7+
b-semantics = { path = "../b-semantics" }
8+
c-semantics = { path = "../c-semantics" }
9+
10+
[targets.llvm]
11+
main-file = 'a.k'
12+
backend='llvm'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module B-SYNTAX
2+
endmodule
3+
4+
module B
5+
endmodule
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[project]
2+
name = "b-semantics"
3+
version = "0.1.0"
4+
source = "."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module C-SYNTAX
2+
endmodule
3+
4+
module C
5+
endmodule
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[project]
2+
name = "c-semantics"
3+
version = "0.1.0"
4+
source = "."

0 commit comments

Comments
 (0)