Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
77e1d660
Unverified
Commit
77e1d660
authored
8 years ago
by
teor
Browse files
Options
Downloads
Patches
Plain Diff
Add get_fname_rnd for unit tests that want a unique path every time
parent
d7634dc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/test.h
+1
-0
1 addition, 0 deletions
src/test/test.h
src/test/testing_common.c
+12
-0
12 additions, 0 deletions
src/test/testing_common.c
with
13 additions
and
0 deletions
src/test/test.h
+
1
−
0
View file @
77e1d660
...
...
@@ -73,6 +73,7 @@
{print_ = (I64_PRINTF_TYPE) value_;}, {}, TT_EXIT_TEST_FUNCTION)
const
char
*
get_fname
(
const
char
*
name
);
const
char
*
get_fname_rnd
(
const
char
*
name
);
struct
crypto_pk_t
*
pk_generate
(
int
idx
);
#define US2_CONCAT_2__(a, b) a ## __ ## b
...
...
This diff is collapsed.
Click to expand it.
src/test/testing_common.c
+
12
−
0
View file @
77e1d660
...
...
@@ -125,6 +125,18 @@ get_fname(const char *name)
return
get_fname_suffix
(
name
,
NULL
);
}
/** Return a filename with a random suffix, relative to our testing temporary
* directory. If name is NULL, return the name of the testing temporary
* directory, without any suffix. */
const
char
*
get_fname_rnd
(
const
char
*
name
)
{
char
rnd
[
256
],
rnd32
[
256
];
crypto_rand
(
rnd
,
RAND_PATH_BYTES
);
base32_encode
(
rnd32
,
sizeof
(
rnd32
),
rnd
,
RAND_PATH_BYTES
);
return
get_fname_suffix
(
name
,
rnd32
);
}
/* Remove a directory and all of its subdirectories */
static
void
rm_rf
(
const
char
*
dir
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment