コード例 #1
0
 def test_get_includes(self):
   include('iostream')
   include('stdio')
   self.assertEqual(
       get_includes_as_include_macros(),
       '#include <stdbool.h>\n#include <iostream>\n#include <stdio>\n')
   self.assertEqual(
       get_includes_in_define_macro(),
       '#define INCLUDES "stdbool.h", \\\n"iostream", \\\n"stdio"')
コード例 #2
0
 def test_include_exceptions(self):
   with self.assertRaises(ValueError):
     include('<my_header_file>')
   with self.assertRaises(ValueError):
     include('"my_header_file"')
   with self.assertRaises(ValueError):
     include('#include "myheaderfile.h"')
コード例 #3
0
#
"""Declares the include files and symbols to be processed by the code generator.

Describes the types that need to be generated with the default values on the
target implementation. For each type, only include the values/members that are
present in newlib as well as the target host library.
"""

from asylo.platform.system_call.type_conversions.types_parse_functions import define_enum
from asylo.platform.system_call.type_conversions.types_parse_functions import define_struct
from asylo.platform.system_call.type_conversions.types_parse_functions import include
from asylo.platform.system_call.type_conversions.types_parse_functions import set_bridge_prefix
from asylo.platform.system_call.type_conversions.types_parse_functions import set_klinux_prefix
from asylo.platform.system_call.type_conversions.types_parse_functions import write_output

include("fcntl.h")
include("netdb.h")
include("netinet/tcp.h")
include("stdint.h")
include("sys/socket.h")

set_klinux_prefix("kLinux")
set_bridge_prefix("bridge")

define_enum(name="FileStatusFlag",
            values=[
                "O_RDONLY", "O_WRONLY", "O_RDWR", "O_CREAT", "O_APPEND",
                "O_EXCL", "O_TRUNC", "O_NONBLOCK", "O_DIRECT", "O_CLOEXEC"
            ],
            multi_valued=True)
コード例 #4
0
#
#
"""Declares the include files and symbols to be processed by the code generator.

Describes the types that need to be generated with the default values on the
target implementation. For each type, only include the values/members that are
present in newlib as well as the target host library.
"""

from asylo.platform.system_call.type_conversions.types_parse_functions import define_enum
from asylo.platform.system_call.type_conversions.types_parse_functions import define_struct
from asylo.platform.system_call.type_conversions.types_parse_functions import include
from asylo.platform.system_call.type_conversions.types_parse_functions import set_klinux_prefix
from asylo.platform.system_call.type_conversions.types_parse_functions import write_output

include("fcntl.h")
include("netdb.h")
include("netinet/tcp.h")
include("stdint.h")
include("sys/inotify.h")
include("sys/socket.h")
include("errno.h")
include("time.h")
include("unistd.h")

set_klinux_prefix("kLinux")

define_enum(name="FileStatusFlag",
            values=[
                "O_RDONLY", "O_WRONLY", "O_RDWR", "O_CREAT", "O_APPEND",
                "O_EXCL", "O_TRUNC", "O_NONBLOCK", "O_DIRECT", "O_CLOEXEC"