~yolanda.robla/ubuntu/trusty/memcached/add_distribution

« back to all changes in this revision

Viewing changes to testapp.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-10-05 13:27:39 UTC
  • mfrom: (1.1.8 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111005132739-ntsnlj16fcze221i
Tags: 1.4.7-0.1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Run as 'memcache' user instead of nobody (LP #599461)
  - Depend on adduser for preinst/postrm
  - Create user in postinst

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
    return TEST_PASS;
115
115
}
116
116
 
 
117
 
 
118
static enum test_return cache_bulkalloc(size_t datasize)
 
119
{
 
120
    cache_t *cache = cache_create("test", datasize, sizeof(char*),
 
121
                                  NULL, NULL);
 
122
#define ITERATIONS 1024
 
123
    void *ptr[ITERATIONS];
 
124
 
 
125
    for (int ii = 0; ii < ITERATIONS; ++ii) {
 
126
        ptr[ii] = cache_alloc(cache);
 
127
        assert(ptr[ii] != 0);
 
128
        memset(ptr[ii], 0xff, datasize);
 
129
    }
 
130
 
 
131
    for (int ii = 0; ii < ITERATIONS; ++ii) {
 
132
        cache_free(cache, ptr[ii]);
 
133
    }
 
134
 
 
135
#undef ITERATIONS
 
136
    cache_destroy(cache);
 
137
    return TEST_PASS;
 
138
}
 
139
 
 
140
static enum test_return test_issue_161(void)
 
141
{
 
142
    enum test_return ret = cache_bulkalloc(1);
 
143
    if (ret == TEST_PASS) {
 
144
        ret = cache_bulkalloc(512);
 
145
    }
 
146
 
 
147
    return ret;
 
148
}
 
149
 
117
150
static enum test_return cache_redzone_test(void)
118
151
{
119
152
#ifndef HAVE_UMEM_H
1786
1819
    { "cache_destructor", cache_destructor_test },
1787
1820
    { "cache_reuse", cache_reuse_test },
1788
1821
    { "cache_redzone", cache_redzone_test },
 
1822
    { "issue_161", test_issue_161 },
1789
1823
    { "strtol", test_safe_strtol },
1790
1824
    { "strtoll", test_safe_strtoll },
1791
1825
    { "strtoul", test_safe_strtoul },