2004-07-28 17:54:14 +02:00
|
|
|
/*
|
|
|
|
* Lasso library C unit tests
|
|
|
|
*
|
2007-05-30 19:17:45 +02:00
|
|
|
* Copyright (C) 2004-2007 Entr'ouvert
|
2004-07-28 17:54:14 +02:00
|
|
|
* http://lasso.entrouvert.org
|
2008-09-12 17:06:58 +02:00
|
|
|
*
|
2005-01-22 16:57:56 +01:00
|
|
|
* Authors: See AUTHORS file in top-level directory.
|
2004-07-28 17:54:14 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-08-01 16:08:54 +02:00
|
|
|
#include <config.h>
|
2004-07-28 17:54:14 +02:00
|
|
|
|
|
|
|
#include <check.h>
|
2009-08-26 17:14:32 +02:00
|
|
|
#include "../lasso/lasso.h"
|
2010-01-04 10:15:32 +01:00
|
|
|
#include "lasso_config.h"
|
2004-07-28 17:54:14 +02:00
|
|
|
|
2004-07-29 11:14:37 +02:00
|
|
|
extern Suite* basic_suite();
|
2004-07-28 17:54:14 +02:00
|
|
|
extern Suite* login_suite();
|
2009-04-23 01:49:17 +02:00
|
|
|
extern Suite* login_saml2_suite();
|
2004-12-21 14:59:40 +01:00
|
|
|
extern Suite* random_suite();
|
2006-11-07 11:24:44 +01:00
|
|
|
extern Suite* metadata_suite();
|
2010-03-27 17:52:04 +01:00
|
|
|
extern Suite* assertion_query_suite();
|
2010-01-04 10:15:32 +01:00
|
|
|
#ifdef LASSO_WSF_ENABLED
|
|
|
|
extern Suite* idwsf2_suite();
|
|
|
|
#endif
|
2004-07-29 11:14:37 +02:00
|
|
|
|
2004-07-28 17:54:14 +02:00
|
|
|
typedef Suite* (*SuiteFunction) ();
|
|
|
|
|
|
|
|
SuiteFunction suites[] = {
|
2004-07-29 11:14:37 +02:00
|
|
|
basic_suite,
|
2004-07-28 17:54:14 +02:00
|
|
|
login_suite,
|
2009-04-23 01:49:17 +02:00
|
|
|
login_saml2_suite,
|
2004-12-21 14:59:40 +01:00
|
|
|
random_suite,
|
2006-11-07 11:24:44 +01:00
|
|
|
metadata_suite,
|
2010-03-27 17:52:04 +01:00
|
|
|
assertion_query_suite,
|
2010-01-04 10:15:32 +01:00
|
|
|
#ifdef LASSO_WSF_ENABLED
|
|
|
|
idwsf2_suite,
|
|
|
|
#endif
|
2004-07-28 17:54:14 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
SRunner *sr;
|
|
|
|
int i;
|
2004-12-21 14:59:40 +01:00
|
|
|
int dont_fork = 0;
|
2004-07-28 17:54:14 +02:00
|
|
|
|
|
|
|
for (i=1; i<argc; i++) {
|
|
|
|
if (strcmp(argv[i], "--dontfork") == 0) {
|
|
|
|
dont_fork = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lasso_init();
|
2008-09-12 17:06:58 +02:00
|
|
|
|
2004-07-28 17:54:14 +02:00
|
|
|
sr = srunner_create(suites[0]());
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while (suites[i]) {
|
|
|
|
srunner_add_suite(sr, suites[i]());
|
2004-07-29 11:14:37 +02:00
|
|
|
i++;
|
2004-07-28 17:54:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dont_fork) {
|
|
|
|
srunner_set_fork_status(sr, CK_NOFORK);
|
|
|
|
}
|
2004-07-29 10:23:55 +02:00
|
|
|
#ifdef CHECK_IS_XML
|
2004-07-28 17:54:14 +02:00
|
|
|
srunner_set_xml(sr, "result.xml");
|
2004-07-29 10:23:55 +02:00
|
|
|
#endif
|
2004-07-28 17:54:14 +02:00
|
|
|
srunner_run_all (sr, CK_VERBOSE);
|
|
|
|
rc = srunner_ntests_failed(sr);
|
2008-09-12 17:06:58 +02:00
|
|
|
|
2004-07-28 17:54:14 +02:00
|
|
|
srunner_free(sr);
|
2004-07-29 10:23:55 +02:00
|
|
|
/*suite_free(s); */
|
|
|
|
/* no longer available in check 0.9.0; it will leak a
|
|
|
|
* bit with previous versions */
|
2009-03-27 16:06:25 +01:00
|
|
|
lasso_shutdown();
|
2004-07-28 17:54:14 +02:00
|
|
|
|
|
|
|
return (rc == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|