Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion git-precommit-hook.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

make test-lit
invoke test

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ python = "^3.4"
[tool.poetry.dev-dependencies]
lit = "^0.9"
bump2version = "0.5.11"
invoke = "1.3.0"

[tool.poetry.scripts]
filecheck = "filecheck.FileCheck:main"
Expand Down
91 changes: 91 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import os
import re

from invoke import task

FILECHECK_LLVM_8_EXEC = 'FileCheck-8.0.1'
FILECHECK_LLVM_9_EXEC = 'FileCheck-9.0.1'


def get_filecheck_py_path():
cwd = os.getcwd()
return "{cwd}/filecheck/FileCheck.py".format(cwd=cwd)


def get_filecheck_llvm_path(filecheck_exec):
cwd = os.getcwd()
exec = "{cwd}/tests/integration/tools/FileCheck/{filecheck_exec}".format(cwd=cwd, filecheck_exec=filecheck_exec)
return exec


def formatted_command(string):
return re.sub('\\s+', ' ', string).strip()


def run_lit_tests(c, filecheck_exec, llvm_only):
assert c
assert filecheck_exec
assert llvm_only is not None

llvm_only_value = "1" if llvm_only else ""

cwd = os.getcwd()

command = formatted_command("""
CURRENT_DIR={cwd}
REAL_ONLY={llvm_only_value} \
FILECHECK_EXEC={filecheck_exec}
PATH={cwd}/tests/integration/tools/FileCheck:{cwd}/tests/integration/tools:$PATH
lit
-vv
{cwd}/tests/integration
""").format(cwd=cwd, filecheck_exec=filecheck_exec, llvm_only_value=llvm_only_value)

print(command)
c.run("{}".format(command))


@task
def test(c):
run_lit_tests(c, get_filecheck_llvm_path(FILECHECK_LLVM_8_EXEC), True)
run_lit_tests(c, get_filecheck_llvm_path(FILECHECK_LLVM_9_EXEC), True)
run_lit_tests(c, get_filecheck_py_path(), False)

@task
def clean(c):
find_command = formatted_command("""
find
.
-type f \\(
-name '*.script'
\\)
-or -type d \\(
-name '*.dSYM' -or
-name 'Sandbox' -or
-name 'Output'
\\)
-not -path "**Expected**"
-not -path "**Input**"
""")

find_result = c.run("{}".format(find_command))
find_result_stdout = find_result.stdout.strip()

echo_command = formatted_command(
"""echo {find_result} | xargs rm -rfv""".format(find_result=find_result_stdout)
)

c.run("{}".format(echo_command))


# https://github.com/github-changelog-generator/github-changelog-generator
# gem install github_changelog_generator
@task
def changelog(c, github_token):
command = formatted_command("""
CHANGELOG_GITHUB_TOKEN={github_token}
github_changelog_generator
--user stanislaw
--project FileCheck.py
""").format(github_token=github_token)
c.run("{}".format(command))
24 changes: 0 additions & 24 deletions tests/integration/Makefile

This file was deleted.