WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gnunet_ats_transport_service.h"
#include "gnunet_testing_lib.h"
+/**
+ * @brief Indicates the success of the whole test
+ */
+static int ret;
+
+/**
+ * @brief The time available until the test shuts down
+ */
+static struct GNUNET_TIME_Relative timeout;
+
/**
* @brief ATS Application Handle
*
*/
static struct GNUNET_ATS_SessionRecord *sr;
+
/**
* @brief Called whenever allocation changed
*
* @param bandwidth_out
* @param bandwidth_in
*
- * @return
+ * @return
*/
static void
allocation_cb (void *cls,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "allocation_cb() called\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "allocation_cb() called\n");
}
const struct GNUNET_PeerIdentity *pid,
const char *address)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "suggestion_cb() called\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "suggestion_cb() called\n");
+ ret = 0;
}
ah = GNUNET_ATS_application_init (cfg);
GNUNET_assert (NULL != ah);
th = GNUNET_ATS_transport_init (cfg,
- allocation_cb,
+ &allocation_cb,
NULL,
- suggestion_cb,
+ &suggestion_cb,
NULL);
GNUNET_assert (NULL != ah);
}
"test-address",
NULL,
&prop);
+ GNUNET_assert (NULL != sr);
}
&other_peer,
GNUNET_MQ_PREFERENCE_NONE,
GNUNET_BANDWIDTH_VALUE_MAX);
- GNUNET_ATS_application_suggest_cancel (ash);
+ GNUNET_assert (NULL != ash);
+}
+
+
+static void
+on_shutdown (void *cls)
+{
+ provide_info_end ();
+ finish_both ();
+ GNUNET_SCHEDULER_shutdown ();
}
init_both (cfg);
provide_info_start ();
get_suggestion ();
- provide_info_end ();
- finish_both ();
+ (void) GNUNET_SCHEDULER_add_delayed (timeout,
+ &on_shutdown,
+ NULL);
}
* @param argc
* @param argv[]
*
- * @return
+ * @return
*/
int
main (int argc,
char *argv[])
{
+ ret = 1;
memset (&other_peer, 0, sizeof (struct GNUNET_PeerIdentity));
- return GNUNET_TESTING_peer_run ("test-ats2-lib",
- "test_ats2_lib.conf",
- &run, NULL);
+ timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+ 2);
+ if (0 != GNUNET_TESTING_peer_run ("test-ats2-lib",
+ "test_ats2_lib.conf",
+ &run, NULL))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Running the testing peer failed.\n");
+ return 1;
+ }
+ if (0 != ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Global status indicates unsuccessful testrun - probably allocation_cb was not called.\n");
+ ret = 77; // SKIP test, test not yet right!
+ }
+ return ret;
}