script:
      # Check that example compiles
    - sed -n '/``` c++/,/```/{/```/d; p;}' README.md > main.cpp
    - PYTHONPATH=mbed-os python mbed-os/tools/make.py -t GCC_ARM -m K82F
          --source=. --build=BUILD/K82F/GCC_ARM -j0      

      # Check that tests compile
    - rm -rf main.cpp BUILD
    - PYTHONPATH=mbed-os python mbed-os/tools/test.py -t GCC_ARM -m K82F
          --source=. --build=BUILD/TESTS/K82F/GCC_ARM -j0
          -n 'tests*'

      # Run littlefs functional tests
    - CFLAGS="-Wno-format" make -Clittlefs test QUIET=1

      # Run littlefs functional tests with different configurations
      # Note: r/w size of 64 is default in mbed
    - CFLAGS="-Wno-format -DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64"
            make -Clittlefs test QUIET=1
    - CFLAGS="-Wno-format -DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
            make -Clittlefs test QUIET=1
    - CFLAGS="-Wno-format -DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
            make -Clittlefs test QUIET=1
    - CFLAGS="-Wno-format -DLFS_BLOCK_COUNT=1023"
            make -Clittlefs test QUIET=1
    - CFLAGS="-Wno-format -DLFS_LOOKAHEAD=2048"
            make -Clittlefs test QUIET=1

      # Self-host with littlefs-fuse for fuzz test
    - CFLAGS="-Wno-format" make -C littlefs-fuse

    - littlefs-fuse/lfs --format /dev/loop0
    - littlefs-fuse/lfs /dev/loop0 mount

    - ls mount
    - mkdir mount/littlefs
    - cp -r $(git ls-tree --name-only HEAD littlefs/) mount/littlefs
    - cd mount/littlefs
    - ls
    - CFLAGS="-Wno-format" make -B test_dirs QUIET=1

install:
      # Get arm-none-eabi-gcc
    - sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
    - sudo apt-get update -qq
    - sudo apt-get install -qq gcc-arm-none-eabi --force-yes
      # Get dependencies
    - git clone https://github.com/armmbed/mbed-os.git
    - git clone https://github.com/armmbed/spiflash-driver.git
      # Install python dependencies
    - pip install --user -r mbed-os/requirements.txt
      # Install littlefs-fuse and dependencies
    - sudo apt-get install libfuse-dev
    - git clone https://github.com/geky/littlefs-fuse
      # Check versions
    - fusermount -V
    - arm-none-eabi-gcc --version
    - python --version
    - gcc --version

before_script:
      # Patch littlefs-fuse
    - rm -rf littlefs-fuse/littlefs/*
    - cp -r $(git ls-tree --name-only HEAD littlefs/) littlefs-fuse/littlefs
    - echo '*' > littlefs-fuse/.mbedignore
      # Create file-backed disk
    - mkdir mount
    - sudo chmod a+rw /dev/loop0
    - dd if=/dev/zero bs=512 count=2048 of=disk
    - losetup /dev/loop0 disk
