From 6e461039b5c3bb73ac903f1f46a7c5d79576c63b Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 23 May 2017 09:33:07 +0200
Subject: [PATCH 1/7] move/update test file

---
 .../B32p1e4_checkpoint_0.h5}                        | Bin
 .../test/test_NSVEparticles.py                      |  10 ++++++----
 setup.py                                            |   3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)
 rename bfps/{test_data/test_checkpoint_0.h5 => test/B32p1e4_checkpoint_0.h5} (100%)
 rename tests/DNS/test_basic.py => bfps/test/test_NSVEparticles.py (88%)

diff --git a/bfps/test_data/test_checkpoint_0.h5 b/bfps/test/B32p1e4_checkpoint_0.h5
similarity index 100%
rename from bfps/test_data/test_checkpoint_0.h5
rename to bfps/test/B32p1e4_checkpoint_0.h5
diff --git a/tests/DNS/test_basic.py b/bfps/test/test_NSVEparticles.py
similarity index 88%
rename from tests/DNS/test_basic.py
rename to bfps/test/test_NSVEparticles.py
index 1c37d06d..ab77e210 100644
--- a/tests/DNS/test_basic.py
+++ b/bfps/test/test_NSVEparticles.py
@@ -1,3 +1,5 @@
+#! /usr/bin/env python
+
 import os
 import numpy as np
 import h5py
@@ -15,8 +17,8 @@ def main():
     c.launch(
             ['NSVEparticles',
              '-n', '32',
-             '--src-simname', 'test',
-             '--src-wd', bfps.lib_dir + '/test_data',
+             '--src-simname', 'B32p1e4',
+             '--src-wd', bfps.lib_dir + '/test',
              '--src-iteration', '0',
              '--simname', 'dns_nsveparticles',
              '--np', '4',
@@ -32,8 +34,8 @@ def main():
              sys.argv[1:])
     f0 = h5py.File(
             os.path.join(
-                os.path.join(bfps.lib_dir, 'test_data'),
-                'test_checkpoint_0.h5'),
+                os.path.join(bfps.lib_dir, 'test'),
+                'B32p1e4_checkpoint_0.h5'),
             'r')
     f1 = h5py.File(c.get_checkpoint_0_fname(), 'r')
     for iteration in [0, 32, 64]:
diff --git a/setup.py b/setup.py
index df707401..6f321df3 100644
--- a/setup.py
+++ b/setup.py
@@ -255,12 +255,13 @@ setup(
         package_data = {'bfps': header_list +
                                 ['libbfps.a',
                                  'install_info.pickle'] +
-                                ['test_data/test_checkpoint_0.h5']},
+                                ['test/B32p1e4_checkpoint_0.h5']},
         entry_points = {
             'console_scripts': [
                 'bfps = bfps.__main__:main',
                 'bfps1 = bfps.__main__:main'],
             },
+        scripts = ['bfps/test/test_NSVEparticles.py'],
         version = VERSION,
 ########################################################################
 # useless stuff folows
-- 
GitLab


From 676b2d7c35d65260de889a0e05544ee56afcecaa Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 23 May 2017 09:36:12 +0200
Subject: [PATCH 2/7] update gitlab CI script

---
 .gitlab-ci.yml                                               | 5 +----
 .../{test_NSVEparticles.py => test_bfps_NSVEparticles.py}    | 0
 setup.py                                                     | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)
 rename bfps/test/{test_NSVEparticles.py => test_bfps_NSVEparticles.py} (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3c51ac91..5cf47886 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,4 @@
 
-
 simple_test:
   script:
     - export destdir=/tmp/bfpsinstall
@@ -10,7 +9,7 @@ simple_test:
     - /home/ubuntu/anaconda3/bin/python3 setup.py compile_library --timing-output 1
     - echo "destdir $destdir"
     - /home/ubuntu/anaconda3/bin/python3 setup.py install --prefix=$destdir
-    - /home/ubuntu/anaconda3/bin/python3 $destdir/bin/bfps DNS NSVEparticles --niter_todo 8 --niter_stat 2 --niter_part 2
+    - /home/ubuntu/anaconda3/bin/python3 $destdir/bin/test_bfps_NSVEparticles.py
     - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
   tags:
     - fftw3
@@ -18,5 +17,3 @@ simple_test:
     - mpi
     - python3
 
-
-
diff --git a/bfps/test/test_NSVEparticles.py b/bfps/test/test_bfps_NSVEparticles.py
similarity index 100%
rename from bfps/test/test_NSVEparticles.py
rename to bfps/test/test_bfps_NSVEparticles.py
diff --git a/setup.py b/setup.py
index 6f321df3..2f4fa4ac 100644
--- a/setup.py
+++ b/setup.py
@@ -261,7 +261,7 @@ setup(
                 'bfps = bfps.__main__:main',
                 'bfps1 = bfps.__main__:main'],
             },
-        scripts = ['bfps/test/test_NSVEparticles.py'],
+        scripts = ['bfps/test/test_bfps_NSVEparticles.py'],
         version = VERSION,
 ########################################################################
 # useless stuff folows
-- 
GitLab


From 4a3b71e69393f8d209be38465f5afa8807d2674e Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 23 May 2017 10:07:20 +0200
Subject: [PATCH 3/7] hack CI script

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5cf47886..1d96dd91 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ simple_test:
     - /home/ubuntu/anaconda3/bin/python3 setup.py compile_library --timing-output 1
     - echo "destdir $destdir"
     - /home/ubuntu/anaconda3/bin/python3 setup.py install --prefix=$destdir
-    - /home/ubuntu/anaconda3/bin/python3 $destdir/bin/test_bfps_NSVEparticles.py
+    - /home/ubuntu/anaconda3/bin/python3 $destdir/lib/python3.6/site-packages/bfps/test/test_bfps_NSVEparticles.py
     - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
   tags:
     - fftw3
-- 
GitLab


From 9260e81f17fdbb93db0cf8d9af4e080a9e3fde92 Mon Sep 17 00:00:00 2001
From: Berenger Bramas <bbramas@mpcdf.mpg.de>
Date: Tue, 23 May 2017 10:15:51 +0200
Subject: [PATCH 4/7] Move test into a script

---
 .gitlab-ci.yml           | 11 +---------
 tests/ci-scripts/test.sh | 45 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 10 deletions(-)
 create mode 100644 tests/ci-scripts/test.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1d96dd91..86587ca1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,16 +1,7 @@
 
 simple_test:
   script:
-    - export destdir=/tmp/bfpsinstall
-    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
-    - if [[ ! -d $destdir/lib/python3.6/site-packages/ ]] ; then mkdir -p $destdir/lib/python3.6/site-packages/ ; fi
-    - export PYTHONPATH=$destdir/lib/python3.6/site-packages/:$PYTHONPATH
-    - export PATH=$destdir/bin/:$PATH
-    - /home/ubuntu/anaconda3/bin/python3 setup.py compile_library --timing-output 1
-    - echo "destdir $destdir"
-    - /home/ubuntu/anaconda3/bin/python3 setup.py install --prefix=$destdir
-    - /home/ubuntu/anaconda3/bin/python3 $destdir/lib/python3.6/site-packages/bfps/test/test_bfps_NSVEparticles.py
-    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
+    - source tests/ci-scripts/test.sh
   tags:
     - fftw3
     - hdf5
diff --git a/tests/ci-scripts/test.sh b/tests/ci-scripts/test.sh
new file mode 100644
index 00000000..fbf18377
--- /dev/null
+++ b/tests/ci-scripts/test.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# print command
+set -x
+# stops when fails
+set -e
+
+# Init
+source ~/.bashrc
+export destdir=/tmp/bfpsinstall
+export pythonbin=/home/ubuntu/anaconda3/bin/python3
+export bfpspythonpath=$destdir/lib/python3.6/site-packages/
+export PYTHONPATH=:$bfpspythonpath$PYTHONPATH
+export PATH=$destdir/bin/:$PATH
+
+echo "destdir = $destdir"
+echo "pythonbin = $pythonbin"
+echo "bfpspythonpath = $bfpspythonpath"
+
+# Remove possible previous installation
+if [[ -d $destdir ]] ; then
+    rm -rf $destdir ;
+fi
+
+# Create install path
+if [[ ! -d $bfpspythonpath ]] ; then
+    mkdir -p $bfpspythonpath ;
+fi
+
+# Build
+$pythonbin setup.py compile_library --timing-output 1
+# Install
+$pythonbin setup.py install --prefix=$destdir
+
+# Test
+ls $destdir
+ls $destdir/bin/
+
+$pythonbin $destdir/bin/test_bfps_NSVEparticles.py
+
+# Clean
+if [[ -d $destdir ]] ; then
+    rm -rf $destdir ;
+fi
+
-- 
GitLab


From ba03b4e93a79f75173565b92dee60600654dd124 Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 23 May 2017 10:53:38 +0200
Subject: [PATCH 5/7] merge origin/feature/extend-CI

---
 .gitlab-ci.yml        | 10 ++++++++++
 bfps/__init__.py      |  1 +
 bfps/test/__init__.py |  0
 setup.py              |  6 +++---
 4 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 bfps/test/__init__.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 86587ca1..9df0b6e7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,16 @@
 simple_test:
   script:
     - source tests/ci-scripts/test.sh
+    - export destdir=/tmp/bfpsinstall
+    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
+    - if [[ ! -d $destdir/lib/python3.6/site-packages/ ]] ; then mkdir -p $destdir/lib/python3.6/site-packages/ ; fi
+    - export PYTHONPATH=$destdir/lib/python3.6/site-packages/:$PYTHONPATH
+    - export PATH=$destdir/bin/:$PATH
+    - /home/ubuntu/anaconda3/bin/python3 setup.py compile_library --timing-output 1
+    - echo "destdir $destdir"
+    - /home/ubuntu/anaconda3/bin/python3 setup.py install --prefix=$destdir
+    - /home/ubuntu/anaconda3/bin/python3 $destdir/bin/bfps.test_NSVEparticles
+    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
   tags:
     - fftw3
     - hdf5
diff --git a/bfps/__init__.py b/bfps/__init__.py
index daecf42d..6c220e69 100644
--- a/bfps/__init__.py
+++ b/bfps/__init__.py
@@ -52,3 +52,4 @@ from .FluidResize import FluidResize
 from .NavierStokes import NavierStokes
 from .NSVorticityEquation import NSVorticityEquation
 
+#import test
diff --git a/bfps/test/__init__.py b/bfps/test/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/setup.py b/setup.py
index 2f4fa4ac..139a4411 100644
--- a/setup.py
+++ b/setup.py
@@ -249,7 +249,7 @@ from setuptools import setup
 
 setup(
         name = 'bfps',
-        packages = ['bfps'],
+        packages = ['bfps', 'bfps/test'],
         install_requires = ['numpy>=1.8', 'h5py>=2.2.1'],
         cmdclass={'compile_library' : CompileLibCommand},
         package_data = {'bfps': header_list +
@@ -259,9 +259,9 @@ setup(
         entry_points = {
             'console_scripts': [
                 'bfps = bfps.__main__:main',
-                'bfps1 = bfps.__main__:main'],
+                'bfps1 = bfps.__main__:main',
+                'bfps.test_NSVEparticles = bfps.test.test_bfps_NSVEparticles:main'],
             },
-        scripts = ['bfps/test/test_bfps_NSVEparticles.py'],
         version = VERSION,
 ########################################################################
 # useless stuff folows
-- 
GitLab


From 1aa6365076e3039cb197cf8d090b8dfc0e6d65e5 Mon Sep 17 00:00:00 2001
From: Berenger Bramas <bbramas@mpcdf.mpg.de>
Date: Tue, 23 May 2017 11:06:38 +0200
Subject: [PATCH 6/7] update ci (change install dir) -- update test command

---
 tests/ci-scripts/test.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/ci-scripts/test.sh b/tests/ci-scripts/test.sh
index fbf18377..ddde2489 100644
--- a/tests/ci-scripts/test.sh
+++ b/tests/ci-scripts/test.sh
@@ -6,12 +6,12 @@ set -x
 set -e
 
 # Init
-source ~/.bashrc
-export destdir=/tmp/bfpsinstall
+export destdir=$(pwd)"/ci-installdir"
 export pythonbin=/home/ubuntu/anaconda3/bin/python3
 export bfpspythonpath=$destdir/lib/python3.6/site-packages/
 export PYTHONPATH=:$bfpspythonpath$PYTHONPATH
-export PATH=$destdir/bin/:$PATH
+export PATH=$destdir/bin/:/home/ubuntu/hdf5/install/bin/:$PATH
+export LD_LIBRARY_PATH=/home/ubuntu/hdf5/install/lib/:/home/ubuntu/fftw/install/lib/
 
 echo "destdir = $destdir"
 echo "pythonbin = $pythonbin"
@@ -36,7 +36,7 @@ $pythonbin setup.py install --prefix=$destdir
 ls $destdir
 ls $destdir/bin/
 
-$pythonbin $destdir/bin/test_bfps_NSVEparticles.py
+$pythonbin $destdir/bin/bfps.test_NSVEparticles
 
 # Clean
 if [[ -d $destdir ]] ; then
-- 
GitLab


From 958ed1ec4ab334a93ef07e3917a9b98a8ddbb0a9 Mon Sep 17 00:00:00 2001
From: Berenger Bramas <bbramas@mpcdf.mpg.de>
Date: Tue, 23 May 2017 11:39:49 +0200
Subject: [PATCH 7/7] move tests inside the test script

---
 .gitlab-ci.yml | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9df0b6e7..86587ca1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,16 +2,6 @@
 simple_test:
   script:
     - source tests/ci-scripts/test.sh
-    - export destdir=/tmp/bfpsinstall
-    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
-    - if [[ ! -d $destdir/lib/python3.6/site-packages/ ]] ; then mkdir -p $destdir/lib/python3.6/site-packages/ ; fi
-    - export PYTHONPATH=$destdir/lib/python3.6/site-packages/:$PYTHONPATH
-    - export PATH=$destdir/bin/:$PATH
-    - /home/ubuntu/anaconda3/bin/python3 setup.py compile_library --timing-output 1
-    - echo "destdir $destdir"
-    - /home/ubuntu/anaconda3/bin/python3 setup.py install --prefix=$destdir
-    - /home/ubuntu/anaconda3/bin/python3 $destdir/bin/bfps.test_NSVEparticles
-    - if [[ -d $destdir ]] ; then rm -rf $destdir ; fi
   tags:
     - fftw3
     - hdf5
-- 
GitLab