import unittest
from yeast_harness import *


class TestLargeSourceTree(unittest.TestCase):

    def test_large_source_tree(self):

        make_filename = lambda ext='': ''.join(
                random.choice(string.ascii_lowercase) for _ in range(8)) + ext

        make_sources = lambda path: [
                CSourceFile(path + '/' + make_filename('.c')) for _ in range(10)]
        make_spore = lambda: SporeFile(
                sources=make_sources(make_filename()),
                products='static_lib',
                name=make_filename('.spore'))

        mk = Makefile(
            spores=[make_spore() for _ in range(10)], name='Makefile')

        with SourceTree('tree') as src:
            src.create(mk)
            build = Build(src, mk)
            self.assertEqual(0, build.make())

import unittest
from yeast_harness import *


class TestLargeSourceTree(unittest.TestCase):

    def test_large_source_tree(self):

        make_filename = lambda ext='': ''.join(
                random.choice(string.ascii_lowercase) for _ in range(8)) + ext

        make_sources = lambda path: [
                CSourceFile(path + '/' + make_filename('.c')) for _ in range(100)]
        make_spore = lambda: SporeFile(
                sources=make_sources(make_filename()),
                products='static_lib',
                name=make_filename('.spore'))

        mk = Makefile(
            spores=[make_spore() for _ in range(10)], name='Makefile')

        with SourceTree('tree', preserve=True) as src:
            src.create(mk)
            build = Build(src, mk)
            self.assertEqual(0, build.make('-j4'))

Increase size of large source tree 10x
Increase size of large source tree 10x

- up to 1000 source files
- use parallel make
- preserve source tree

  import unittest
  from yeast_harness import *
  
  
  class TestLargeSourceTree(unittest.TestCase):
  
      def test_large_source_tree(self):
  
          make_filename = lambda ext='': ''.join(
                  random.choice(string.ascii_lowercase) for _ in range(8)) + ext
  
          make_sources = lambda path: [
-                 CSourceFile(path + '/' + make_filename('.c')) for _ in range(10)]
+                 CSourceFile(path + '/' + make_filename('.c')) for _ in range(100)]
          make_spore = lambda: SporeFile(
                  sources=make_sources(make_filename()),
                  products='static_lib',
                  name=make_filename('.spore'))
  
          mk = Makefile(
              spores=[make_spore() for _ in range(10)], name='Makefile')
  
-         with SourceTree('tree') as src:
+         with SourceTree('tree', preserve=True) as src:
              src.create(mk)
              build = Build(src, mk)
-             self.assertEqual(0, build.make())
+             self.assertEqual(0, build.make('-j4'))
  
Increase size of large source tree 10x
## Code Before:
import unittest
from yeast_harness import *


class TestLargeSourceTree(unittest.TestCase):

    def test_large_source_tree(self):

        make_filename = lambda ext='': ''.join(
                random.choice(string.ascii_lowercase) for _ in range(8)) + ext

        make_sources = lambda path: [
                CSourceFile(path + '/' + make_filename('.c')) for _ in range(10)]
        make_spore = lambda: SporeFile(
                sources=make_sources(make_filename()),
                products='static_lib',
                name=make_filename('.spore'))

        mk = Makefile(
            spores=[make_spore() for _ in range(10)], name='Makefile')

        with SourceTree('tree') as src:
            src.create(mk)
            build = Build(src, mk)
            self.assertEqual(0, build.make())

## Instruction:
Increase size of large source tree 10x
## Code After:
import unittest
from yeast_harness import *


class TestLargeSourceTree(unittest.TestCase):

    def test_large_source_tree(self):

        make_filename = lambda ext='': ''.join(
                random.choice(string.ascii_lowercase) for _ in range(8)) + ext

        make_sources = lambda path: [
                CSourceFile(path + '/' + make_filename('.c')) for _ in range(100)]
        make_spore = lambda: SporeFile(
                sources=make_sources(make_filename()),
                products='static_lib',
                name=make_filename('.spore'))

        mk = Makefile(
            spores=[make_spore() for _ in range(10)], name='Makefile')

        with SourceTree('tree', preserve=True) as src:
            src.create(mk)
            build = Build(src, mk)
            self.assertEqual(0, build.make('-j4'))
