2013-03-07 08:37:42 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the libsigrok project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de>
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <check.h>
|
2014-07-20 10:03:29 +00:00
|
|
|
#include "../include/libsigrok/libsigrok.h"
|
2013-03-07 08:37:42 +00:00
|
|
|
#include "lib.h"
|
|
|
|
|
|
|
|
/* Check whether at least one driver is available. */
|
|
|
|
START_TEST(test_driver_available)
|
|
|
|
{
|
|
|
|
struct sr_dev_driver **drivers;
|
|
|
|
|
|
|
|
drivers = sr_driver_list();
|
|
|
|
fail_unless(drivers != NULL, "No drivers found.");
|
|
|
|
}
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
/* Check whether initializing all drivers works. */
|
|
|
|
START_TEST(test_driver_init_all)
|
|
|
|
{
|
2014-08-11 11:20:50 +00:00
|
|
|
srtest_driver_init_all(srtest_ctx);
|
2013-03-07 08:37:42 +00:00
|
|
|
}
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check whether setting a samplerate works.
|
|
|
|
*
|
|
|
|
* Additionally, this also checks whether SR_CONF_SAMPLERATE can be both
|
|
|
|
* set and read back properly.
|
|
|
|
*/
|
2013-04-27 17:06:27 +00:00
|
|
|
#if 0
|
2013-03-07 08:37:42 +00:00
|
|
|
START_TEST(test_config_get_set_samplerate)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note: This currently only works for the demo driver.
|
|
|
|
* For other drivers, a scan is needed and the respective
|
|
|
|
* hardware must be attached to the host running the testsuite.
|
|
|
|
*/
|
|
|
|
srtest_check_samplerate(sr_ctx, "demo", SR_KHZ(19));
|
|
|
|
}
|
|
|
|
END_TEST
|
2013-04-27 17:06:27 +00:00
|
|
|
#endif
|
2013-03-07 08:37:42 +00:00
|
|
|
|
|
|
|
Suite *suite_driver_all(void)
|
|
|
|
{
|
|
|
|
Suite *s;
|
|
|
|
TCase *tc;
|
|
|
|
|
|
|
|
s = suite_create("driver-all");
|
|
|
|
|
|
|
|
tc = tcase_create("config");
|
2014-08-11 11:20:50 +00:00
|
|
|
tcase_add_checked_fixture(tc, srtest_setup, srtest_teardown);
|
2013-03-07 08:37:42 +00:00
|
|
|
tcase_add_test(tc, test_driver_available);
|
|
|
|
tcase_add_test(tc, test_driver_init_all);
|
2013-04-27 17:06:27 +00:00
|
|
|
// TODO: Currently broken.
|
|
|
|
// tcase_add_test(tc, test_config_get_set_samplerate);
|
2013-03-07 08:37:42 +00:00
|
|
|
suite_add_tcase(s, tc);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|