Updating standards
This commit is contained in:
parent
f7049cdd15
commit
334a900c95
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ __pycache__
|
||||
*.tar.zst.sig
|
||||
pkg/
|
||||
src/
|
||||
wiki/
|
||||
|
9
Makefile
9
Makefile
@ -1,11 +1,11 @@
|
||||
pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//'
|
||||
|
||||
compile: c cs java bash php perl python
|
||||
compile: c java bash php perl python cs
|
||||
@echo Done
|
||||
|
||||
install: clean
|
||||
install: clean compile test
|
||||
mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/
|
||||
rsync -avzp HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/
|
||||
install -m root -o 0644 ./HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/
|
||||
|
||||
test: compile
|
||||
python3 -m pytest
|
||||
@ -13,6 +13,9 @@ test: compile
|
||||
clean:
|
||||
for i in `cat .gitignore`; do /bin/bash -c "rm -Rf $$i"; done
|
||||
|
||||
uninstall:
|
||||
rm -Rf ${pkgdir}/opt/aninix/${pkgdirname}/
|
||||
|
||||
diff:
|
||||
@echo Nothing to do.
|
||||
|
||||
|
4
PKGBUILD
4
PKGBUILD
@ -5,7 +5,7 @@ pkgrel() {
|
||||
git log "$(git describe --tag --abbrev=0)"..HEAD | grep -c commit
|
||||
}
|
||||
epoch=
|
||||
pkgdesc="$(head -n 1 README)"
|
||||
pkgdesc="$(head -n 1 README.md)"
|
||||
arch=("x86_64")
|
||||
url="https://aninix.net/foundation/${pkgname}"
|
||||
license=('custom')
|
||||
@ -16,7 +16,7 @@ checkdepends=()
|
||||
optdepends=()
|
||||
provides=("${pkgname}")
|
||||
conflicts=()
|
||||
replaces=()
|
||||
replaces=("${pkgname,,}","aninix-${pkgname,,}")
|
||||
backup=()
|
||||
options=()
|
||||
install=
|
||||
|
33
tests/global_fns.py
Normal file
33
tests/global_fns.py
Normal file
@ -0,0 +1,33 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
def checkOutput(output):
|
||||
"""
|
||||
Ensure hello world is in string.
|
||||
return: whether hello world is present
|
||||
"""
|
||||
return output == 'Hello world!\n'
|
||||
|
||||
def runCommand(command):
|
||||
"""
|
||||
Define a function to run a shell commmand and return the output
|
||||
param command: command to run
|
||||
return: Whether retcode is 0
|
||||
"""
|
||||
fh = os.popen(command, mode='r', buffering=-1)
|
||||
output = fh.read()
|
||||
retcode = fh.close()
|
||||
assert retcode == None
|
||||
|
||||
|
||||
def runCommandAndOutputCheck(command):
|
||||
"""
|
||||
Define a function to run a shell command and ensure output is correct
|
||||
param command: command
|
||||
return: Whether retcode is 0 && output matches test.
|
||||
"""
|
||||
fh = os.popen(command, mode='r', buffering=-1)
|
||||
output = fh.read()
|
||||
retcode = fh.close()
|
||||
assert retcode == None and CheckOutput(output)
|
24
tests/test_c.py
Normal file
24
tests/test_c.py
Normal file
@ -0,0 +1,24 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from tests.global_fns import *
|
||||
|
||||
def test_compile_c():
|
||||
fh = os.popen("gcc -o HelloWorld ./HelloWorld.c", mode='r', buffering=-1)
|
||||
output = fh.read()
|
||||
retcode = fh.close()
|
||||
assert retcode == None
|
||||
|
||||
|
||||
def test_c():
|
||||
fh = os.popen("./HelloWorld", mode='r', buffering=-1)
|
||||
output = fh.read()
|
||||
retcode = fh.close()
|
||||
assert retcode == None and checkOutput(output)
|
||||
|
||||
def test_c_cleanup():
|
||||
fh = os.popen("rm ./HelloWorld", mode='r', buffering=-1)
|
||||
output = fh.read()
|
||||
retcode = fh.close()
|
||||
assert retcode == None
|
Loading…
Reference in New Issue
Block a user