Browse Source

Skip preprocessing when cpp unavailable

tags/v0.0.1
Joost Rijneveld 5 years ago
parent
commit
97e428a0b7
No known key found for this signature in database GPG Key ID: A4FE39CF49CBC553
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      test/test_char.py

+ 5
- 0
test/test_char.py View File

@@ -7,6 +7,8 @@ This is ambiguous; compilers can freely choose `signed` or `unsigned` char.
import pqclean import pqclean
import pycparser import pycparser
import os import os
import unittest
import shutil




def test_char(): def test_char():
@@ -25,6 +27,8 @@ def walk_tree(ast):




def check_char(implementation): def check_char(implementation):
if not shutil.which('cpp'):
raise unittest.SkipTest("C pre-processor (cpp) was not found.")
errors = [] errors = []
for fname in os.listdir(implementation.path()): for fname in os.listdir(implementation.path()):
if not fname.endswith(".c"): if not fname.endswith(".c"):
@@ -34,6 +38,7 @@ def check_char(implementation):
os.path.join(implementation.path(), fname), os.path.join(implementation.path(), fname),
use_cpp=True, use_cpp=True,
cpp_args=[ cpp_args=[
'-std=c99',
'-nostdinc', # pycparser cannot deal with e.g. __attribute__ '-nostdinc', # pycparser cannot deal with e.g. __attribute__
'-I{}'.format(os.path.join(tdir, "../common")), '-I{}'.format(os.path.join(tdir, "../common")),
# necessary to mock e.g. <stdint.h> # necessary to mock e.g. <stdint.h>


Loading…
Cancel
Save