mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2025-12-20 04:20:04 +01:00
check: More thoroughly test variable usage
Add some more tests for handling unusual variables such as those that are quoted or that contain shell characters. This should help make the --variable output more reliable in the future. https://bugs.freedesktop.org/show_bug.cgi?id=93284
This commit is contained in:
parent
1c564a3583
commit
a3e58e7d4d
4 changed files with 38 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ TESTS = \
|
|||
check-tilde \
|
||||
check-relocatable \
|
||||
check-variable-override \
|
||||
check-variables \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
@ -99,4 +100,6 @@ EXTRA_DIST = \
|
|||
tilde.pc \
|
||||
pkgconfig/prefixdef.pc \
|
||||
pkgconfig/prefixdef-expanded.pc \
|
||||
pcfiledir.pc
|
||||
pcfiledir.pc \
|
||||
variables.pc \
|
||||
$(NULL)
|
||||
|
|
|
|||
18
check/check-variables
Executable file
18
check/check-variables
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
||||
# Check quoted variables are stripped. In 0.28 and earlier, this would
|
||||
# contain the "" quotes.
|
||||
RESULT='/local/include'
|
||||
run_test --variable=includedir variables
|
||||
|
||||
# Non-quoted variables are output as is. In 0.29, the \ would be stripped.
|
||||
RESULT='-I"/local/include"/foo -DFOO=\"/bar\"'
|
||||
run_test --variable=cppflags variables
|
||||
|
||||
# Check the entire cflags output
|
||||
RESULT='-DFOO=\"/bar\" -I/local/include -I/local/include/foo'
|
||||
run_test --cflags variables
|
||||
|
|
@ -4,6 +4,11 @@ set -e
|
|||
|
||||
. ${srcdir}/common
|
||||
|
||||
# variables come out unquoted. In 0.28 and earlier, this would also
|
||||
# contain the ""s quoting the variable.
|
||||
RESULT='/usr/white space/include'
|
||||
run_test --variable=includedir whitespace
|
||||
|
||||
# expect cflags from whitespace
|
||||
RESULT='-Dlala=misc -I/usr/white\ space/include -I$(top_builddir) -Iinclude\ dir -Iother\ include\ dir'
|
||||
run_test --cflags whitespace
|
||||
|
|
|
|||
11
check/variables.pc
Normal file
11
check/variables.pc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix=/local
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir="${prefix}/include"
|
||||
cppflags=-I${includedir}/foo \
|
||||
-DFOO=\"/bar\"
|
||||
|
||||
Name: Complex variables
|
||||
Description: Test complex variable output
|
||||
Version: 1.0
|
||||
Cflags: -I${includedir} ${cppflags}
|
||||
Loading…
Add table
Reference in a new issue