Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests #4259

Merged
merged 14 commits into from
Aug 16, 2015
Merged

unit tests #4259

merged 14 commits into from
Aug 16, 2015

Conversation

arturoc
Copy link
Member

@arturoc arturoc commented Aug 16, 2015

some tests i've been using mainly for the changes in ofFileSystem + an OF addon for unit tests.

right now is pretty simple and could be integrated in the future with some already existing unit tests framework.

  • The addon has a ofxUnitTestsApp that is an ofBaseApp so tests can implement it to be called with the proper OF initialization. Most tests only need to implement a run() method in that class
  • It provides, test and test_eq methods by now that will fail if the result is not true or the passed parameters are not equal
  • It also provides a colored log channel so the output from tests is easily checked

This is ready to be merged but mostly uploading it to test: #4285 which is working fine for me

arturoc added a commit that referenced this pull request Aug 16, 2015
@arturoc arturoc merged commit 8c862a4 into openframeworks:master Aug 16, 2015
@arturoc arturoc deleted the feature-unittests branch August 16, 2015 16:15
@@ -13,11 +13,18 @@ echo "PLATFORM_CFLAGS += $CUSTOMFLAGS" >> libs/openFrameworksCompiled/project/li
cd libs/openFrameworksCompiled/project
make Debug

echo "Building emptyExample"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturoc why did you delete this part? I don't think a CI build is really sensible if we can't even build the emptyexample. Even if we don't want to build that temporarily, why delete this and not simply comment it out and adding some explanation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

building empty example makes the build crash and my suspicion is that this is happening because empty example is including ofMain.h which is huge. i've changed it to build the tests which are much lighter because they only include the headers that are needed and it seems to work better.

the tests are also normal applications so if those are building emptyExample should build too.

empty example is also building in osx so we will catch most possible errors affecting emptyExample but not the tests there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

building empty example makes the build crash

unit tests also make the build crash, so you just replaced one build-crashing application with another...

@bilderbuchi
Copy link
Member

@arturoc how nice of you to just merge these changes to the CI setup without waiting for any review or input. You must have been aware that I'm currently trying to improve that setup.
I know that you are part of @openframeworks/core but sometimes it would be great to wait a little to invite comments/feedback. 😞
For example, the way I envision the setup is to separate builds and test runs into separate scripts, so it will be more easily recognizable if travis fails because of the former or the latter. Also, if you plan to just delete the emptyexample build from the CI process, it would be great to say so - I wouldn't have bothered spending hours/days on tinkering with gcc flags and travis tweaks to get this to run. Sometimes I wonder why I even bother...

cd $test
cp ../../../scripts/osx/template/Makefile .
cp ../../../scripts/osx/template/config.make .
make Debug
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturoc wouldn't it be better to also use xcodebuild for this (or make for the main compilation) to have homogenity in the build system per platform?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this compiles OF library twice, once with xcode, and once with make, see https://travis-ci.org/openframeworks/openFrameworks/jobs/75829657#L984

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know, i'll change it when i have time but if i use xcodebuild i need to compile the PG, generate the project for the tests and then compile them so it's not trivial. i'll probably move the PG generation here if i finally do it like that

@bilderbuchi bilderbuchi mentioned this pull request Aug 16, 2015
9 tasks
@arturoc
Copy link
Member Author

arturoc commented Aug 16, 2015

the tests are using the same flags you've been adding, i've only removed
the empty example and added a test, i don't think is such a big deal but
feel free to change the travis file as you wish.

i'm doing a ton crap of work to get the release out and it helps a lot
to be able to tests things on each platform and generate the PG without
having to switch between 5 platforms manually in my computer.

On 16.08.2015 20:55, Christoph Buchner wrote:

@arturoc https://github.com/arturoc how nice of you to just merge
these changes to the CI setup without waiting for any review or input.
You must have been aware that I'm currently trying to improve that setup.
I know that you are part of @openframeworks/core
https://github.com/orgs/openframeworks/teams/core but sometimes it
would be great to wait a little to invite comments/feedback. 😞
For example, the way I envision the setup is to separate builds and test
runs into separate scripts, so it will be more easily recognizable if
travis fails because of the former or the latter. Also, if you plan to
just delete the emptyexample build from the CI process, it would be
great to say so - I wouldn't have bothered spending hours/days on
tinkering with gcc flags and travis tweaks to get this to run. Sometimes
I wonder why I even bother...


Reply to this email directly or view it on GitHub
#4259 (comment).

@kylemcdonald
Copy link
Contributor

@tpltnt you expressed interest in working on unit tests in OF, it looks like @arturoc has decided this is the direction they will be going so please feel free to jump in once this is merged :)

edit: sorry, i missed that it is already merged, hadn't finished reading the PR yet. so i guess: jump in!

@kylemcdonald kylemcdonald mentioned this pull request Nov 1, 2015
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants