Пример #1
0
    def test_should_not_pollute_classpath_when_processor_path_is_set(self):
        """
        Tests that annotation processors get their own class path, isolated from Buck's.

        There was a bug caused by adding annotation processors and setting the processorpath
        for javac. In that case, Buck's version of guava would leak into the classpath of the
        annotation processor causing it to fail to run and all heck breaking loose."""

        test_data = os.path.join(
            "test",
            "com",
            "facebook",
            "buck",
            "cli",
            "bootstrapper",
            "testdata",
            "old_guava",
        )

        with ProjectWorkspace(test_data) as workspace:
            returncode = workspace.run_buck(
                "build",
                "//:example",
            )
            self.assertEquals(0, returncode)
Пример #2
0
    def test_log_retention(self):
        """ Tests that the default java.util.logging setup can maintain at least 'a couple'
            of log files. """
        test_data = os.path.join('test', 'com', 'facebook', 'buck', 'log', 'testdata', 'log')

        with ProjectWorkspace(test_data) as workspace:
            iterations = 3
            for i in xrange(0, iterations):
                returncode = workspace.run_buck('targets', '//:foo')
                self.assertEquals(0, returncode)

            logs = glob.glob(
                os.path.join(workspace.test_data_directory, 'buck-out', 'log', 'buck*.log'))

            self.assertEquals(iterations, len(logs))
Пример #3
0
 def test_buck_run(self):
     test_data = os.path.join("test", "com", "facebook", "buck", "cli",
                              "testdata", "buck_run")
     with ProjectWorkspace(test_data) as workspace:
         self.assertEqual(0, workspace.run_buck("run", "//:hello-java"))
         self.assertEqual(0, workspace.run_buck("run", "//:hello-cxx"))
         self.assertEqual(0, workspace.run_buck("run", "//:hello-python"))
         subdir = workspace.resolve_path("subdir")
         os.mkdir(subdir)
         proc = run_buck_process(["run", "//:pwd"], subdir)
         stdout, stderr = proc.communicate()
         sys.stdout.write(stdout.decode("utf8"))
         sys.stdout.flush()
         sys.stderr.write(stderr.decode("utf8"))
         sys.stderr.flush()
         self.assertEqual(0, proc.returncode)
Пример #4
0
 def test_buck_run(self):
     test_data = os.path.join('test', 'com', 'facebook', 'buck', 'cli',
                              'testdata', 'buck_run')
     with ProjectWorkspace(test_data) as workspace:
         self.assertEqual(0, workspace.run_buck('run', '//:hello-java'))
         self.assertEqual(0, workspace.run_buck('run', '//:hello-cxx'))
         self.assertEqual(0, workspace.run_buck('run', '//:hello-python'))
         subdir = workspace.resolve_path('subdir')
         os.mkdir(subdir)
         proc = run_buck_process(['run', '//:pwd'], subdir)
         stdout, stderr = proc.communicate()
         sys.stdout.write(stdout)
         sys.stdout.flush()
         sys.stderr.write(stderr)
         sys.stderr.flush()
         self.assertEqual(0, proc.returncode)
Пример #5
0
    def test_log_retention(self):
        """ Tests that the default java.util.logging setup can maintain at least 'a couple'
            of log files. """
        test_data = os.path.join("test", "com", "facebook", "buck", "log",
                                 "testdata", "log")

        with ProjectWorkspace(test_data) as workspace:
            iterations = 3
            for i in range(0, iterations):
                returncode = workspace.run_buck(
                    "targets",
                    "//:foo",
                )
                self.assertEquals(0, returncode)

            logs = glob.glob(
                os.path.join(workspace.test_data_directory, "buck-out", "log",
                             "buck*.log"))
            self.assertEquals(iterations, len(logs))