Skip to content

Commit

Permalink
Bug 1385061 - Build NSPR tests with NSS make; Add gyp parameters to b…
Browse files Browse the repository at this point in the history
…uild/run NSPR tests. r=jcj
  • Loading branch information
kaie committed Sep 12, 2019
1 parent 5df121e commit 6bb5282
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -135,6 +135,7 @@ endif

build_nspr: $(NSPR_CONFIG_STATUS)
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests

install_nspr: build_nspr
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
Expand Down
11 changes: 11 additions & 0 deletions build.sh
Expand Up @@ -54,6 +54,9 @@ build_64=0
clean=0
rebuild_gyp=0
rebuild_nspr=0
build_nspr_tests=0
run_nspr_tests=0
exit_after_nspr=0
target=Debug
verbose=0
fuzz=0
Expand Down Expand Up @@ -117,6 +120,9 @@ while [ $# -gt 0 ]; do
--static) gyp_params+=(-Dstatic_libs=1) ;;
--ct-verif) gyp_params+=(-Dct_verif=1) ;;
--nspr) nspr_clean; rebuild_nspr=1 ;;
--nspr-test-build) build_nspr_tests=1 ;;
--nspr-test-run) run_nspr_tests=1 ;;
--nspr-only) exit_after_nspr=1 ;;
--with-nspr=?*) set_nspr_path "${1#*=}"; no_local_nspr=1 ;;
--system-nspr) set_nspr_path "/usr/include/nspr/:"; no_local_nspr=1 ;;
--system-sqlite) gyp_params+=(-Duse_system_sqlite=1) ;;
Expand Down Expand Up @@ -225,6 +231,11 @@ if [[ "$rebuild_nspr" = 1 && "$no_local_nspr" = 0 ]]; then
nspr_build
mv -f "$nspr_config.new" "$nspr_config"
fi

if [ "$exit_after_nspr" = 1 ]; then
exit 0
fi

# gyp.
if [ "$rebuild_gyp" = 1 ]; then
if ! hash "$GYP" 2> /dev/null; then
Expand Down
21 changes: 18 additions & 3 deletions coreconf/nspr.sh
Expand Up @@ -36,15 +36,30 @@ nspr_build()
extra_params+=(--enable-64bit)
fi

echo "NSPR [1/3] configure ..."
echo "NSPR [1/5] configure ..."
pushd "$nspr_dir" >/dev/null
CFLAGS="$nspr_cflags" CXXFLAGS="$nspr_cxxflags" \
LDFLAGS="$nspr_ldflags" CC="$CC" CXX="$CCC" \
run_verbose ../configure "${extra_params[@]}" "$@"
popd >/dev/null
echo "NSPR [2/3] make ..."
echo "NSPR [2/5] make ..."
run_verbose make -C "$nspr_dir"
echo "NSPR [3/3] install ..."

if [ "$build_nspr_tests" = 1 ]; then
echo "NSPR [3/5] build tests ..."
run_verbose make -C "$nspr_dir/pr/tests"
else
echo "NSPR [3/5] NOT building tests"
fi

if [[ "$build_nspr_tests" = 1 && "$run_nspr_tests" = 1 ]]; then
echo "NSPR [4/5] run tests ..."
run_verbose make -C "$nspr_dir/pr/tests" runtests
else
echo "NSPR [4/5] NOT running tests"
fi

echo "NSPR [5/5] install ..."
run_verbose make -C "$nspr_dir" install
}

Expand Down
3 changes: 3 additions & 0 deletions help.txt
Expand Up @@ -43,6 +43,9 @@ NSS build tool options:
--static create static libraries and use static linking
--ct-verif build with valgrind for ct-verif
--nspr force a rebuild of NSPR
--nspr-test-build when building NSPR also build its tests
--nspr-test-run when building NSPR tests also run its tests
--nspr-only exit after building NSPR
--with-nspr use the NSPR build at the given locations
--with-nspr=<include>:<lib> sets include and lib paths
--system-nspr attempt to use system nspr
Expand Down

0 comments on commit 6bb5282

Please sign in to comment.