Updating standards

This commit is contained in:
DarkFeather 2022-08-29 00:10:10 -05:00
parent f7049cdd15
commit 334a900c95
Signed by: DarkFeather
GPG Key ID: 1CC1E3F4ED06F296
6 changed files with 66 additions and 5 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ __pycache__
*.tar.zst.sig *.tar.zst.sig
pkg/ pkg/
src/ src/
wiki/

View File

@ -1,11 +1,11 @@
pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//' 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 @echo Done
install: clean install: clean compile test
mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/ 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 test: compile
python3 -m pytest python3 -m pytest
@ -13,6 +13,9 @@ test: compile
clean: clean:
for i in `cat .gitignore`; do /bin/bash -c "rm -Rf $$i"; done for i in `cat .gitignore`; do /bin/bash -c "rm -Rf $$i"; done
uninstall:
rm -Rf ${pkgdir}/opt/aninix/${pkgdirname}/
diff: diff:
@echo Nothing to do. @echo Nothing to do.

View File

@ -5,7 +5,7 @@ pkgrel() {
git log "$(git describe --tag --abbrev=0)"..HEAD | grep -c commit git log "$(git describe --tag --abbrev=0)"..HEAD | grep -c commit
} }
epoch= epoch=
pkgdesc="$(head -n 1 README)" pkgdesc="$(head -n 1 README.md)"
arch=("x86_64") arch=("x86_64")
url="https://aninix.net/foundation/${pkgname}" url="https://aninix.net/foundation/${pkgname}"
license=('custom') license=('custom')
@ -16,7 +16,7 @@ checkdepends=()
optdepends=() optdepends=()
provides=("${pkgname}") provides=("${pkgname}")
conflicts=() conflicts=()
replaces=() replaces=("${pkgname,,}","aninix-${pkgname,,}")
backup=() backup=()
options=() options=()
install= install=

View File

33
tests/global_fns.py Normal file
View 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
View 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