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/>.
-*/
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file transport/test_transport_api_reliability.c
* @brief base test case for transport implementations
/**
* Testcase timeout
*/
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 450 * FACTOR)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 450 \
+ * FACTOR)
/**
* If we are in an "xhdr" test, the factor by which we divide
size_t ret;
ret = (iter * iter * iter);
-#ifndef LINUX
+#ifndef __linux__
/* FreeBSD/OSX etc. Unix DGRAMs do not work
* with large messages */
if (0 == strcmp ("unix", ccc->test_plugin))
- ret = sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 1024);
+ ret = sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 1024);
#endif
- ret = sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 60000);
+ ret = sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 60000);
return ret;
}
size_t arraySlot;
unsigned int targetBit;
- if (bitIdx >= sizeof (bitmap) * 8)
+ if (bitIdx >= sizeof(bitmap) * 8)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"tried to set bit %u of %u(!?!?)\n",
bitIdx,
- (unsigned int) sizeof (bitmap) * 8);
+ (unsigned int) sizeof(bitmap) * 8);
return GNUNET_SYSERR;
}
arraySlot = bitIdx / 8;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"get bit %u of %u(!?!?)\n",
bit,
- (unsigned int) sizeof (bitmap) * 8);
+ (unsigned int) sizeof(bitmap) * 8);
return 0;
}
return ((map)[bit >> 3] & (1 << (bit & 7))) > 0;
/* Calculcate statistics */
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
- rate = (1000LL* 1000ll * total_bytes) / (1024 * delta);
- FPRINTF (stderr,
+ if (0 == delta)
+ delta = 1;
+ rate = (1000LL * 1000ll * total_bytes) / (1024 * delta);
+ fprintf (stderr,
"\nThroughput was %llu KiBytes/s\n",
rate);
{
}
memset (cbuf,
- ntohl (hdr->num),
- s - sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage));
+ ntohl (hdr->num),
+ s - sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage));
if (0 !=
memcmp (cbuf,
- &hdr[1],
- s - sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage)))
+ &hdr[1],
+ s - sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expected message %u with bits %u, but body did not match\n",
n++;
if (GNUNET_SYSERR == set_bit (ntohl (hdr->num)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Message id %u is bigger than maxmimum number of messages %u expected\n",
- (uint32_t) ntohl (hdr->num),
- TOTAL_MSGS / xhdr);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Message id %u is bigger than maxmimum number of messages %u expected\n",
+ (uint32_t) ntohl (hdr->num),
+ TOTAL_MSGS / xhdr);
}
if (0 == (n % (TOTAL_MSGS / xhdr / 100)))
{
- FPRINTF (stderr, "%s", ".");
+ fprintf (stderr, "%s", ".");
}
if (n == TOTAL_MSGS / xhdr)
{