TITLE: A counter-example for integration by parts when there are "small" singularities
QUESTION [6 upvotes]: I am looking for a "counter-example" to integration by parts of the following type:
$\Omega \subseteq \mathbb R^n$ is an open, bounded, connected domain with smooth boundary. $u,v:\bar \Omega \to \mathbb R$ are real-valued functions, where $u$ is smooth and compactly supported in $\Omega$, and $v$ is smooth on an open subset of $\bar \Omega$ whose complement is a closed subset of measure zero. I want $\int_{\Omega}(\partial_iu)v \neq -\int_{\Omega}u(\partial_iv)$, i.e. to demonstrate failure of integration by parts.
Edit:
Does the answer change if we assume in addition that $v$ is continuous everywhere on $\bar \Omega$?. BigbearZzz gave here an example with a non-continuous $v$.

If $v$ was smooth on all $\bar \Omega$, then integration by parts would work. The point is that I am limiting the singular set to be closed and of measure zero. I guess integration by parts still cannot be saved, but I don't have a concrete example.

REPLY [3 votes]: For a continuous counterexample, let's consider the case $\Bbb R^n=\Bbb R$ and $\Omega = (0,1)$. Let $v$ be the Cantor function

It has the property that $v'(x)=0$ a.e., thus for any function $\varphi\in C^\infty_c(0,1)$ we have
$$
\int_0^1 \varphi v' = 0.
$$
On the other hand, we have 
$$\begin{align}
\int_0^1 \varphi'v = -c_0\int_{0}^1 \varphi(t)\, d\nu(t) 
\end{align}$$
where $\nu=\mathcal H^\gamma\lvert_C$, the Hausdorff measure of dimension $\gamma= \ln 2 /\ln 3$ restricted to the Cantor set $C$ (which is a compact set). Here $c_0$ is a normalizing constant that I don't remember.