Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few Infrastructure fixes #411

Merged
merged 3 commits into from
May 26, 2022
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
15 changes: 15 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PMIx Standard

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out the code
uses: actions/checkout@v1
# Run the container tester
- name: Build and Test
run: docker run --rm -v ${GITHUB_WORKSPACE}:/home/pmixer/pmix-standard jjhursey/pmix-standard /bin/bash -c "cp -R /home/pmixer/pmix-standard pmix-build && cd pmix-build && make"
shell: bash
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ figs/~$drawings.pptx
*.soc
_minted*
sources/_autogen_/
debug-files
28 changes: 16 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

version=4.0
OPENPMIX_BRANCH ?= "v4.0"
default: pmix-standard.pdf

all: pmix-standard.pdf check

CHAPTERS= \
TitlePage.tex \
Expand Down Expand Up @@ -47,12 +48,13 @@ INTERMEDIATE_FILES=pmix-standard.pdf \
pmix-standard.blg \
pmix-standard.synctex.gz \
pmix-standard.xwm \
*.idx *.ilg *.ind
*.idx *.ilg *.ind \
debug-files

all: pmix-standard.pdf

pmix-standard.pdf: $(CHAPTERS) $(SOURCES) pmix.sty pmix-standard.tex figs/pmix-logo.png
rm -f $(INTERMEDIATE_FILES)
rm -rf $(INTERMEDIATE_FILES)
@echo "-------------------------------------------------------------"
@echo "If error occurs check pmix-standard.log and pmix-standard.ind"
@echo "-------------------------------------------------------------"
Expand All @@ -68,34 +70,36 @@ pmix-standard.pdf: $(CHAPTERS) $(SOURCES) pmix.sty pmix-standard.tex figs/pmix-l
pdflatex -interaction=batchmode -file-line-error pmix-standard.tex || \
pdflatex -interaction=errorstopmode -file-line-error pmix-standard.tex < /dev/null
pdflatex -interaction=batchmode -file-line-error pmix-standard.tex
@./bin/check-doc.sh
@echo "====> Success"
@cp pmix-standard.pdf pmix-standard-${version}.pdf

FORCECHECK:

check: check-doc check-openpmix
check: check-doc display-stats

# Includes
# - make check-decl
# - make check-attr-ref
check-doc: pmix-standard.pdf FORCECHECK
check-doc: pmix-standard.pdf
@./bin/check-doc.sh
@echo "========> Success <========"

check-attr-ref: pmix-standard.pdf FORCECHECK
check-attr-ref: pmix-standard.pdf
@echo "====> Checking for Attributes Declared, but not referenced"
@./bin/check-attr-refs.py

check-decl: pmix-standard.pdf FORCECHECK
check-decl: pmix-standard.pdf
@echo "====> Checking for Multi-declared items"
@./bin/check-multi-declare.py

# The default is defined near the top of the Makefile
# To change the default at runtime you can manually set the envar:
# OPENPMIX_BRANCH=master make check-openpmix
check-openpmix: pmix-standard.pdf FORCECHECK
check-openpmix: pmix-standard.pdf
@echo "====> Checking cross-reference with OpenPMIx"
@./bin/check-openpmix.py -b ${OPENPMIX_BRANCH}

display-stats: pmix-standard.pdf
@echo "====> Display Stats"
@mkdir -p debug-files
@./bin/display-stats.py -f debug-files/std

clean:
rm -f $(INTERMEDIATE_FILES) pmix-standard-*.pdf
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/pmix/pmix-standard.svg?branch=master)](https://travis-ci.org/pmix/pmix-standard)
[![Build Status](https://github.com/pmix/pmix-standard/actions/workflows/build-main.yml/badge.svg)](https://github.com/pmix/pmix-standard/actions/workflows/build-main.yml)

# PMIx Standard

Expand Down
2 changes: 1 addition & 1 deletion bin/check-attr-refs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python -u
#!/usr/bin/env -S python3 -u

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion bin/check-multi-declare.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python -u
#!/usr/bin/env -S python3 -u

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion bin/check-openpmix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python -u
#!/usr/bin/env -S python3 -u

import sys
import os
Expand Down
144 changes: 144 additions & 0 deletions bin/display-stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/usr/bin/env -S python3 -u

import sys
import os
import re
import argparse
import subprocess
import shutil

class Reference:
def __init__(self, name):
self.name = name
self.is_dep = False
self.is_rm = False

def __str__(self):
if self.is_dep:
return self.name + " (Deprecated)"
elif self.is_rm:
return self.name + " (Removed)"
else:
return self.name

def __cmp__(self, other):
return (self.name < other.name)

def display_header():
print("Valid | Deprecated | Removed | Description")
display_footer()

def display_footer():
print("------+------------+---------+--------------")

def display_counts(refs, desc, filename = None):
num_total = len(refs)
num_dep = sum(x.is_dep for x in refs)
num_rm = sum(x.is_rm for x in refs)
num_active = num_total - num_dep - num_rm

print("%5d | %10d | %7d | %s" % (num_active, num_dep, num_rm, desc))

if filename is not None:
output = filename + "-" + desc + "-Deprecated.txt";
with open(output, "w") as f:
for x in sorted(refs, key=lambda x: x.name):
if x.is_dep is True:
f.write(x.name + "\n")
output = filename + "-" + desc + "-Removed.txt";
with open(output, "w") as f:
for x in sorted(refs, key=lambda x: x.name):
if x.is_rm is True:
f.write(x.name + "\n")
output = filename + "-" + desc + ".txt";
with open(output, "w") as f:
for x in sorted(refs, key=lambda x: x.name):
if x.is_dep is False and x.is_rm is False:
f.write(x.name + "\n")

if __name__ == "__main__":
std_all = []
std_attributes = []
std_macros = []
std_consts = []
std_structs = []
std_apis = []

#
# Command line parsing
#
parser = argparse.ArgumentParser(description="PMIx Standard Display Interface Stats")
parser.add_argument("-v", "--verbose", help="Verbose output", action="store_true")
parser.add_argument("-d", "--debug", help="Debugging output", action="store_true")
parser.add_argument("-f", "--filename", help="File prefix to write values")

parser.parse_args()
args = parser.parse_args()

if os.path.exists("pmix-standard.aux") is False:
print("Error: Cannot find the .aux files necessary for processing in the current directory.")
print(" Please run this script from the base PMIx Standard build directory, and with a recent build.")
sys.exit(1)

#
# Extract all declarations
#
all_ref_strs = ["attr", "const", "struct", "macro", "apifn"]
for ref_str in all_ref_strs:
if args.verbose is True:
print("-"*50)
print("Extracting Standard: \""+ref_str+"\"")
print("-"*50)

# subsection.A is Appendix A: Python Bindings
p = subprocess.Popen("grep \"newlabel{"+ref_str+"\" pmix-standard.aux | grep -v \"subsection.A\"",
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, close_fds=True)
sout = p.communicate()[0].decode("utf-8").splitlines()
if p.returncode != 0:
print("Error: Failed to extract declared \""+ref_str+"\". grep error code "+str(p.returncode)+")");
sys.exit(2)

for line in sout:
line = line.rstrip()
m = re.match(r"\s*\\newlabel{"+ re.escape(ref_str) + r":(\w+)", line)
if m is None:
print("Error: Failed to extract an \""+ref_str+"\" on the following line")
print(" line: "+line)
sys.exit(1)

ref = Reference(m.group(1))
ref.is_dep = re.search(r"Deprecated", line) is not None
ref.is_rm = re.search(r"Removed", line) is not None
std_all.append(ref)

if args.debug is True:
print("DEBUG: Classify: %s" % ref)

if ref_str == "attr":
std_attributes.append(ref)
elif ref_str == "const":
std_consts.append(ref)
elif ref_str == "struct":
std_structs.append(ref)
elif ref_str == "macro":
std_macros.append(ref)
elif ref_str == "apifn":
std_apis.append(ref)
else:
print("Error: Failed to classify: %s" % ref)
sys.exit(1)
p.wait()

#
# Display summary
#
display_header()
display_counts(std_apis, "APIs", args.filename)
display_counts(std_attributes, "Attributes", args.filename)
display_counts(std_consts, "Constants", args.filename)
display_counts(std_macros, "Macros", args.filename)
display_counts(std_structs, "Structs", args.filename)
display_footer()
display_counts(std_all, "Totals")

sys.exit(0)