Skip to content

Commit efb38f8

Browse files
Add 'projects/hip-tests/' from commit '2a22548203e2a643a521593665b31257cf833a88'
git-subtree-dir: projects/hip-tests git-subtree-mainline: f0ff2fc git-subtree-split: 2a22548
2 parents f0ff2fc + 2a22548 commit efb38f8

File tree

1,509 files changed

+350135
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,509 files changed

+350135
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
resources:
2+
repositories:
3+
- repository: pipelines_repo
4+
type: github
5+
endpoint: ROCm
6+
name: ROCm/ROCm
7+
pipelines:
8+
- pipeline: hip_pipeline
9+
source: \HIP
10+
trigger:
11+
branches:
12+
include:
13+
- amd-staging
14+
- amd-mainline
15+
16+
variables:
17+
- group: common
18+
- template: /.azuredevops/variables-global.yml@pipelines_repo
19+
20+
trigger:
21+
batch: true
22+
branches:
23+
include:
24+
- amd-staging
25+
- amd-mainline
26+
paths:
27+
exclude:
28+
- '.jenkins'
29+
- CODEOWNERS
30+
- LICENSE.txt
31+
- '**/.md'
32+
33+
pr:
34+
autoCancel: true
35+
branches:
36+
include:
37+
- amd-staging
38+
- amd-mainline
39+
paths:
40+
exclude:
41+
- '.jenkins'
42+
- CODEOWNERS
43+
- LICENSE.txt
44+
- '**/.md'
45+
drafts: false
46+
47+
jobs:
48+
- template: ${{ variables.CI_COMPONENT_PATH }}/hip-tests.yml@pipelines_repo

projects/hip-tests/.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Language: Cpp
2+
BasedOnStyle: Google
3+
AlignEscapedNewlinesLeft: false
4+
AlignOperands: false
5+
ColumnLimit: 100
6+
AlwaysBreakTemplateDeclarations: false
7+
DerivePointerAlignment: false
8+
IndentFunctionDeclarationAfterType: false
9+
MaxEmptyLinesToKeep: 2
10+
SortIncludes: false

projects/hip-tests/.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Set the default behavior, in case people don't have core.autolf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to have LF line endings on checkout.
6+
*.c text eol=lf
7+
*.cpp text eol=lf
8+
*.cc text eol=lf
9+
*.h text eol=lf
10+
*.hpp text eol=lf
11+
*.txt text eol=lf
12+
13+
# Define files to support auto-remove trailing white space
14+
# Need to run the command below, before add modified file(s) to the staging area
15+
# git config filter.trimspace.clean 'sed -e "s/[[:space:]]*$//g"'
16+
*.cpp filter=trimspace
17+
*.c filter=trimspace
18+
*.h filter=trimspacecpp
19+
*.hpp filter=trimspace
20+
*.md filter=trimspace
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
RANGE=""
6+
7+
while [[ $# -gt 0 ]]; do
8+
echo $1
9+
echo $2
10+
case "$1" in
11+
--range)
12+
RANGE="$2"
13+
shift 2
14+
;;
15+
*)
16+
echo "Unknown arg $1" >&2
17+
exit 64
18+
;;
19+
esac
20+
done
21+
22+
regex='\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$'
23+
24+
if [[ -n $RANGE ]]; then
25+
files=$(git diff --name-only "$RANGE" | grep -E "$regex" || true)
26+
else
27+
files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E "$regex" || true)
28+
fi
29+
echo "Checking $files"
30+
[[ -z $files ]] && exit 0
31+
32+
clang_bin="${CLANG_FORMAT:-clang-format}"
33+
if ! command -v "$clang_bin" >/dev/null 2>&1; then
34+
if [[ -x "/c/Program Files/LLVM/bin/clang-format.exe" ]]; then
35+
clang_bin="/c/Program Files/LLVM/bin/clang-format.exe"
36+
fi
37+
fi
38+
39+
clang_format_diff="${CLANG_FORMAT_DIFF:-clang-format-diff}"
40+
if ! command -v "$clang_format_diff" >/dev/null 2>&1; then
41+
if [[ -x "/c/Program Files/LLVM/share/clang/clang-format-diff.py" ]]; then
42+
clang_format_diff="/c/Program Files/LLVM/share/clang/clang-format-diff.py"
43+
fi
44+
fi
45+
46+
for file in $files; do
47+
echo "Checking lines of $file"
48+
49+
if [[ -n $RANGE ]]; then
50+
diff_output=$(git diff -U0 "$RANGE" -- "$file")
51+
else
52+
diff_output=$(git diff -U0 --cached -- "$file")
53+
fi
54+
55+
echo "$diff_output" | "$clang_format_diff" -style=file -fallback-style=none -p1
56+
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
exec "$(git rev-parse --show-toplevel)/.github/hooks/clang-format-check.sh"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
disabled: false
2+
scmId: gh-emu-rocm
3+
branchesToScan:
4+
- amd-staging
5+
- amd-mainline
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Associated JIRA ticket number/Github issue number
2+
<!-- For example: "Closes #1234" or "Fixes SWDEV-123456" -->
3+
4+
## What type of PR is this? (check all applicable)
5+
6+
- [ ] Refactor
7+
- [ ] Feature
8+
- [ ] Bug Fix
9+
- [ ] Optimization
10+
- [ ] Documentation Update
11+
- [ ] Continuous Integration
12+
13+
## What were the changes?
14+
15+
<!-- Please give a short summary of the change. -->
16+
17+
## Why are these changes needed?
18+
19+
<!-- Please explain the motivation behind the change and why this solves the given problem. -->
20+
21+
## Updated CHANGELOG?
22+
23+
<!-- Needed for Release updates for a ROCm release. -->
24+
25+
- [ ] Yes
26+
- [ ] No, Does not apply to this PR.
27+
28+
## Added/Updated documentation?
29+
30+
- [ ] Yes
31+
- [ ] No, Does not apply to this PR.
32+
33+
## Additional Checks
34+
35+
- [ ] I have added tests relevant to the introduced functionality, and the unit tests are passing locally.
36+
- [ ] Any dependent changes have been merged.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import os, re, sys
2+
from typing import List, Optional
3+
4+
5+
def is_checkbox(line: str) -> bool:
6+
return bool(re.match(r"^\s*-\s*\[[ xX]\]\s*.+", line))
7+
8+
9+
def is_checked(line: str) -> bool:
10+
return bool(re.match(r"^\s*-\s*\[[xX]\]\s*.+", line))
11+
12+
13+
def is_comment(line: str) -> bool:
14+
return bool(re.match(r"^\s*<!--.*-->\s*$", line))
15+
16+
17+
def text_clean(lines: List[str]) -> str:
18+
text = [line for line in lines if not is_comment(line)]
19+
return "".join("".join(text).strip().split())
20+
21+
22+
def validate_section(section_name: str, lines: List[str]) -> Optional[str]:
23+
has_checkboxes = any(is_checkbox(line) for line in lines)
24+
if has_checkboxes:
25+
if not any(is_checked(line) for line in lines):
26+
return f"Section {section_name} is a checklist without selections"
27+
return None
28+
if not text_clean(lines):
29+
return f"Section {section_name} is empty text section"
30+
return None
31+
32+
33+
def check_description(description: str) -> List[str]:
34+
if not description:
35+
# pull_request_template is not merged yet, so treat as valid for now
36+
return []
37+
# return ["PR description is empty"]
38+
39+
sections = []
40+
current_section = None
41+
current_lines = []
42+
errors = []
43+
44+
for line in description.splitlines():
45+
header_match = re.match(r"^\s*##\s*(.+?)\s*$", line)
46+
if header_match:
47+
if current_section:
48+
sections.append((current_section, current_lines))
49+
current_section = header_match.group(1)
50+
current_lines = []
51+
elif current_section:
52+
current_lines.append(line)
53+
54+
if current_section:
55+
sections.append((current_section, current_lines))
56+
57+
if not sections:
58+
return ["No sections available, template is empty"]
59+
60+
for section_name, section_lines in sections:
61+
error = validate_section(section_name, section_lines)
62+
if error:
63+
errors.append(error)
64+
65+
return errors
66+
67+
68+
if __name__ == "__main__":
69+
pr_description = os.getenv("PR_DESCRIPTION", "")
70+
71+
errors = check_description(pr_description)
72+
if not errors:
73+
print("All good")
74+
exit(0)
75+
print("\n".join(errors))
76+
exit(1)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Clang format check
2+
on:
3+
pull_request:
4+
types: [synchronize, opened]
5+
6+
jobs:
7+
format:
8+
runs-on: AMD-ROCm-Internal-dev1
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Install clang-format
15+
run: |
16+
sudo apt update && sudo apt install -y clang-format
17+
18+
- name: Run clang-format-check
19+
id: clang-format
20+
run: |
21+
chmod +x .github/hooks/clang-format-check.sh
22+
./.github/hooks/clang-format-check.sh --range "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Keywords checker
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
branches:
7+
- amd-staging
8+
workflow_dispatch:
9+
10+
jobs:
11+
check-keywords:
12+
runs-on: AMD-ROCm-Internal-dev1
13+
env:
14+
KEYWORDS: ${{ vars.KEYWORDS }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Check keywords
23+
run: |
24+
set -e
25+
26+
if [ -z "$KEYWORDS" ]; then
27+
echo "No keywords set. Skipping check"
28+
exit 0
29+
fi
30+
31+
IFS=',' read -ra KEYWORDS_ARRAY <<< "$KEYWORDS"
32+
echo "Checking against list of keywords: ${KEYWORDS_ARRAY[*]}"
33+
34+
MATCHED=0
35+
BASE_BRANCH=${{github.event.pull_request.base.ref}}
36+
HEAD_BRANCH=${{github.event.pull_request.head.ref}}
37+
PR_TITLE="${{ github.event.pull_request.title }}"
38+
39+
for file in $(git diff --name-only origin/$BASE_BRANCH..origin/$HEAD_BRANCH); do
40+
if [ -f "$file" ]; then
41+
for keyword in "${KEYWORDS_ARRAY[*]}"; do
42+
grep -in -E "${keyword}" "$file" | while IFS= read -r line; do
43+
echo "Matched in '$file': $line"
44+
MATCHED=1
45+
done
46+
done
47+
fi
48+
done
49+
50+
for commit in $(git log --format=%H origin/$BASE_BRANCH..origin/$HEAD_BRANCH); do
51+
msg=$(git log -1 --format=%B "$commit")
52+
for keyword in "${KEYWORDS_ARRAY[*]}"; do
53+
if echo "$msg" | grep -i -q "$keyword"; then
54+
echo "Match in commit $commit: $msg"
55+
MATCHED=1
56+
fi
57+
done
58+
done
59+
60+
for keyword in "${KEYWORDS_ARRAY[*]}"; do
61+
if echo "$PR_TITLE" | grep -i -q "$keyword"; then
62+
echo "Match in PR title"
63+
MATCHED=1
64+
fi
65+
done
66+
67+
if [ "$MATCHED" -eq 1 ]; then
68+
echo "Keywords found, please see diagnostics higher"
69+
exit 1
70+
else
71+
echo "No keywords found"
72+
exit 0
73+
fi

0 commit comments

Comments
 (0)