Exemplo n.º 1
0
 if not "--skip-codetests" in sys.argv:
   from subuserlib.classes.docker.dockerDaemon import DockerDaemon
   import subuserlib.classes.docker.dockerDaemon
   from subuserlib.classes.fileStructure import BasicFileStructure
   dockerDaemon = DockerDaemon(MockUser())
   testDockerfileNames = [
    "Dockerfile-arch-python3",
    "Dockerfile-debian-python2",
   ]
   for testDockerfileName in testDockerfileNames:
     with io.open(os.path.join(subuserlib.paths.getSubuserDir(),"test",testDockerfileName),encoding="utf-8",mode="r") as dockerfile:
       dockerfileContents = dockerfile.read()
     try:
       subuserDir = BasicFileStructure(subuserlib.paths.getSubuserDir())
       id = dockerDaemon.build(repositoryFileStructure=subuserDir,relativeBuildContextPath="./",useCache=True,dockerfile=dockerfileContents)
       if dockerDaemon.execute(["run","-it","--volume",subuserlib.paths.getSubuserDir()+":/root/subuser:ro",id,"/root/subuser/logic/subuser","test"]) != 0:
         raise Exception()
     except Exception as e:
       print(subuserlib.terminalColors.FAIL+"Tests failed!"+subuserlib.terminalColors.ENDC)
       print(str(e))
       if not "--no-fail" in sys.argv:
         exit(1)
 if "--x11-bridge" in sys.argv:
   pid = os.fork()
   if pid:
     counter = "a"
   else:
     counter = "b"
   for i in range(1,6):
     print(counter+" "+str(i))
     command = [os.path.join(subuserlib.paths.getSubuserDir(),"logic","subuser"),"run","xterm"]
Exemplo n.º 2
0
   from subuserlib.classes.docker.dockerDaemon import DockerDaemon
   import subuserlib.classes.docker.dockerDaemon
   from subuserlib.classes.fileStructure import BasicFileStructure
   dockerDaemon = DockerDaemon(MockUser())
   testDockerfileNames = [
    "Dockerfile-arch-python3",
    "Dockerfile-debian-python2",
   ]
   for testDockerfileName in testDockerfileNames:
     with io.open(os.path.join(subuserlib.paths.getSubuserDir(),"test",testDockerfileName),encoding="utf-8",mode="r") as dockerfile:
       dockerfileContents = dockerfile.read()
     try:
       subuserDir = BasicFileStructure(subuserlib.paths.getSubuserDir())
       id = dockerDaemon.build(repositoryFileStructure=subuserDir,relativeBuildContextPath="./",useCache=True,dockerfile=dockerfileContents)
       passedOnArgs = set(["--diff"])
       if dockerDaemon.execute(["run","-it","--volume",subuserlib.paths.getSubuserDir()+":/root/subuser:ro",id,"/root/subuser/logic/subuser","test"]+list(passedOnArgs.intersection(set(sys.argv)))) != 0:
         raise Exception()
     except Exception as e:
       print(subuserlib.terminalColors.FAIL+"Tests failed!"+subuserlib.terminalColors.ENDC)
       print(str(e))
       if not "--no-fail" in sys.argv:
         exit(1)
 if "--x11-bridge" in sys.argv:
   pid = os.fork()
   if pid:
     counter = "a"
   else:
     counter = "b"
   for i in range(1,6):
     print(counter+" "+str(i))
     command = [os.path.join(subuserlib.paths.getSubuserDir(),"logic","subuser"),"run","xterm"]
Exemplo n.º 3
0
         with io.open(os.path.join(subuserlib.paths.getSubuserDir(), "test",
                                   testDockerfileName),
                      encoding="utf-8",
                      mode="r") as dockerfile:
             dockerfileContents = dockerfile.read()
         try:
             subuserDir = BasicFileStructure(
                 subuserlib.paths.getSubuserDir())
             id = dockerDaemon.build(repositoryFileStructure=subuserDir,
                                     relativeBuildContextPath="./",
                                     useCache=True,
                                     dockerfile=dockerfileContents)
             passedOnArgs = set(["--diff"])
             if dockerDaemon.execute([
                     "run", "-it", "--volume",
                     subuserlib.paths.getSubuserDir() + ":/root/subuser:ro",
                     id, "/root/subuser/logic/subuser", "test"
             ] + list(passedOnArgs.intersection(set(sys.argv)))) != 0:
                 raise Exception()
         except Exception as e:
             print(subuserlib.terminalColors.FAIL + "Tests failed!" +
                   subuserlib.terminalColors.ENDC)
             print(str(e))
             if not "--no-fail" in sys.argv:
                 exit(1)
 if "--x11-bridge" in sys.argv:
     pid = os.fork()
     if pid:
         counter = "a"
     else:
         counter = "b"
Exemplo n.º 4
0
     for testDockerfileName in testDockerfileNames:
         with io.open(os.path.join(subuserlib.paths.getSubuserDir(), "test",
                                   testDockerfileName),
                      encoding="utf-8",
                      mode="r") as dockerfile:
             dockerfileContents = dockerfile.read()
         try:
             subuserDir = BasicFileStructure(
                 subuserlib.paths.getSubuserDir())
             id = dockerDaemon.build(repositoryFileStructure=subuserDir,
                                     relativeBuildContextPath="./",
                                     useCache=True,
                                     dockerfile=dockerfileContents)
             if dockerDaemon.execute([
                     "run", "-it", "--volume",
                     subuserlib.paths.getSubuserDir() + ":/root/subuser:ro",
                     id, "/root/subuser/logic/subuser", "test"
             ]) != 0:
                 raise Exception()
         except Exception as e:
             print(subuserlib.terminalColors.FAIL + "Tests failed!" +
                   subuserlib.terminalColors.ENDC)
             print(str(e))
             if not "--no-fail" in sys.argv:
                 exit(1)
 if "--x11-bridge" in sys.argv:
     pid = os.fork()
     if pid:
         counter = "a"
     else:
         counter = "b"