Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libsecret
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
28
Issues
28
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
libsecret
Commits
f2b7f6d5
Commit
f2b7f6d5
authored
Aug 19, 2019
by
Daiki Ueno
Committed by
Daiki Ueno
Oct 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secret-tool: Add tests using file backend
parent
8e431723
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
1 deletion
+122
-1
Makefile.am
Makefile.am
+4
-1
meson.build
meson.build
+4
-0
tool/Makefile.am
tool/Makefile.am
+4
-0
tool/meson.build
tool/meson.build
+6
-0
tool/test-secret-tool.sh
tool/test-secret-tool.sh
+104
-0
No files found.
Makefile.am
View file @
f2b7f6d5
...
...
@@ -52,7 +52,10 @@ dist-hook: dist-check-valac
distcleancheck_listfiles
=
\
find
.
-name
'*.gc[dn][oa]'
-prune
-o
-type
f
-print
TESTS_ENVIRONMENT
=
LD_LIBRARY_PATH
=
$(builddir)
/.libs
GI_TYPELIB_PATH
=
$(builddir)
TESTS_ENVIRONMENT
=
\
LD_LIBRARY_PATH
=
$(builddir)
/.libs
\
GI_TYPELIB_PATH
=
$(builddir)
\
abs_top_builddir
=
$(abs_top_builddir)
TEST_EXTENSIONS
=
.py .js
# Default executable tests
...
...
meson.build
View file @
f2b7f6d5
...
...
@@ -70,6 +70,10 @@ conf.set('_DEBUG', enable_debug)
conf.set('HAVE_MLOCK', meson.get_compiler('c').has_function('mlock'))
configure_file(output: 'config.h', configuration: conf)
# Test environment
test_env = environment()
test_env.set('abs_top_builddir', meson.build_root())
# Subfolders
subdir('po')
subdir('egg')
...
...
tool/Makefile.am
View file @
f2b7f6d5
...
...
@@ -5,3 +5,7 @@ tool_secret_tool_SOURCES = \
tool_secret_tool_LDADD
=
\
libsecret-@SECRET_MAJOR@.la
if
WITH_GCRYPT
TESTS
+=
tool/test-secret-tool.sh
endif
tool/meson.build
View file @
f2b7f6d5
...
...
@@ -9,3 +9,9 @@ secret_tool = executable('secret-tool',
c_args: libsecret_cflags,
install: true,
)
if with_gcrypt and host_machine.system() != 'windows'
test('test-secret-tool.sh',
find_program('test-secret-tool.sh'),
env: test_env)
endif
tool/test-secret-tool.sh
0 → 100755
View file @
f2b7f6d5
#!/bin/sh
set
-e
testdir
=
$PWD
/test-secret-tool-
$$
test
-d
"
$testdir
"
||
mkdir
"
$testdir
"
cleanup
()
{
rm
-rf
"
$testdir
"
}
trap
cleanup 0
cd
"
$testdir
"
SECRET_BACKEND
=
file
export
SECRET_BACKEND
SECRET_FILE_TEST_PATH
=
$testdir
/keyring
export
SECRET_FILE_TEST_PATH
SECRET_FILE_TEST_PASSWORD
=
test
export
SECRET_FILE_TEST_PASSWORD
:
${
SECRET_TOOL
=
"
$abs_top_builddir
"
/tool/secret-tool
}
:
${
DIFF
=diff
}
echo
1..4
echo
test1 |
${
SECRET_TOOL
}
store
--label
label1 foo bar
if
test
$?
-eq
0
;
then
echo
"ok 1 /secret-tool/store"
else
echo
"not ok 1 /secret-tool/store"
fi
echo
test2 |
${
SECRET_TOOL
}
store
--label
label2 foo bar apple orange
if
test
$?
-eq
0
;
then
echo
"ok 1 /secret-tool/store"
else
echo
"not ok 1 /secret-tool/store"
fi
echo
test1
>
lookup.exp
${
SECRET_TOOL
}
lookup foo bar
>
lookup.out
if
${
DIFF
}
lookup.exp lookup.out
>
lookup.diff
;
then
echo
"ok 2 /secret-tool/lookup"
else
echo
"not ok 2 /secret-tool/lookup"
sed
's/^/# /'
lookup.diff
exit
1
fi
cat
>
search.exp
<<
EOF
[no path]
label = label1
secret = test1
[no path]
label = label2
secret = test2
EOF
${
SECRET_TOOL
}
search foo bar |
sed
'/^created\|^modified/d'
>
search.out
if
test
$?
-ne
0
;
then
echo
"not ok 3 /secret-tool/search"
exit
1
fi
if
${
DIFF
}
search.exp search.out
>
search.diff
;
then
echo
"ok 3 /secret-tool/search"
else
echo
"not ok 3 /secret-tool/search"
sed
's/^/# /'
search.diff
exit
1
fi
${
SECRET_TOOL
}
clear apple orange
if
test
$?
-eq
0
;
then
echo
"ok 4 /secret-tool/clear"
else
echo
"not ok 4 /secret-tool/clear"
exit
1
fi
cat
>
search-after-clear.exp
<<
EOF
[no path]
label = label1
secret = test1
EOF
${
SECRET_TOOL
}
search foo bar |
sed
'/^created\|^modified/d'
>
search-after-clear.out
if
test
$?
-ne
0
;
then
echo
"not ok 5 /secret-tool/search-after-clear"
exit
1
fi
if
${
DIFF
}
search-after-clear.exp search-after-clear.out
>
search-after-clear.diff
;
then
echo
"ok 5 /secret-tool/search-after-clear"
else
echo
"not ok 5 /secret-tool/search-after-clear"
sed
's/^/# /'
search-after-clear.diff
exit
1
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment